Difference between revisions of "RC-Summary.php"
From Organic Design wiki
(Construct formatted line for each change) |
(Format as query-string for SWF if raw output requested) |
||
Line 1: | Line 1: | ||
<? | <? | ||
# Appends article with a compact list of last 5 non-minor changes | # Appends article with a compact list of last 5 non-minor changes | ||
− | global $wgLang, $wgContLang; | + | global $wgLang, $wgContLang, $xwRaw; |
$db =& wfGetDB( DB_MASTER ); | $db =& wfGetDB( DB_MASTER ); | ||
$result = $db->query( "SELECT rc_id, rc_timestamp, rc_user_text, rc_namespace, rc_title, rc_comment FROM recentchanges WHERE rc_minor=0 ORDER BY rc_timestamp DESC LIMIT 5" ); | $result = $db->query( "SELECT rc_id, rc_timestamp, rc_user_text, rc_namespace, rc_title, rc_comment FROM recentchanges WHERE rc_minor=0 ORDER BY rc_timestamp DESC LIMIT 5" ); | ||
+ | $changes = []; | ||
while ($row = mysql_fetch_assoc($result)) { | while ($row = mysql_fetch_assoc($result)) { | ||
$time = $wgLang->time( $row['rc_timestamp'], true ); | $time = $wgLang->time( $row['rc_timestamp'], true ); | ||
$ns = $wgContLang->getNsText( $row['rc_namespace'] ); | $ns = $wgContLang->getNsText( $row['rc_namespace'] ); | ||
$title = $ns ? "$ns:".$row['rc_title'] : $row['rc_title']; | $title = $ns ? "$ns:".$row['rc_title'] : $row['rc_title']; | ||
− | $ | + | $changes[] = 'id'.$row['rc_id']."=$time,".$row['rc_user_text'].",$title,".$row['rc_comment']; |
− | |||
} | } | ||
+ | $article = join( $xwRaw ? '&' : '<br>', $changes ); | ||
?> | ?> |
Revision as of 20:29, 23 February 2006
<?
- Appends article with a compact list of last 5 non-minor changes
global $wgLang, $wgContLang, $xwRaw;
$db =& wfGetDB( DB_MASTER );
$result = $db->query( "SELECT rc_id, rc_timestamp, rc_user_text, rc_namespace, rc_title, rc_comment FROM recentchanges WHERE rc_minor=0 ORDER BY rc_timestamp DESC LIMIT 5" );
$changes = [];
while ($row = mysql_fetch_assoc($result)) {
$time = $wgLang->time( $row['rc_timestamp'], true );
$ns = $wgContLang->getNsText( $row['rc_namespace'] );
$title = $ns ? "$ns:".$row['rc_title'] : $row['rc_title'];
$changes[] = 'id'.$row['rc_id']."=$time,".$row['rc_user_text'].",$title,".$row['rc_comment'];
}
$article = join( $xwRaw ? '&' : '
', $changes );
?>