X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=irc%2Frcdumper.php;h=684f53aee4b24e498a5ac4c81ded552a294a1d23;hb=734906f8523f278fdaa62f872e63a56ff012dd13;hp=0ba026cd799a385f797bcd1c0eea5eece9266669;hpb=60a91448d611a9ecb5e65dc4cf91c4f601d065a4;p=lhc%2Fweb%2Fwiklou.git diff --git a/irc/rcdumper.php b/irc/rcdumper.php index 0ba026cd79..684f53aee4 100644 --- a/irc/rcdumper.php +++ b/irc/rcdumper.php @@ -1,52 +1,52 @@ tableName( 'recentchanges' ); -$res = wfQuery( "SELECT rc_timestamp FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1", DB_READ ); -$row = wfFetchObject( $res ); +$res = $dbr->query( "SELECT rc_timestamp FROM $recentchanges ORDER BY rc_timestamp DESC LIMIT 1" ); +$row = $dbr->fetchObject( $res ); $oldTimestamp = $row->rc_timestamp; +$serverCount = 0; while (1) { - $res = wfQuery( "SELECT * FROM recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp", DB_READ ); + $res = $dbr->query( "SELECT * FROM $recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp" ); $rowIndex = 0; - while ( $row = wfFetchObject( $res ) ) { + while ( $row = $dbr->fetchObject( $res ) ) { + if ( ++$serverCount % 20 == 0 ) { + print "/server $ircServer\n"; + } $ns = $wgLang->getNsText( $row->rc_namespace ) ; if ( $ns ) { $title = "$ns:{$row->rc_title}"; @@ -66,30 +66,16 @@ while (1) { $lastid = IntVal($row->rc_last_oldid); $flag = ($row->rc_minor ? "M" : "") . ($row->rc_new ? "N" : ""); if ( $row->rc_new ) { - $url = "http://$lang.wikipedia.org/wiki/" . urlencode($title); + $url = $newPageURLFirstPart . urlencode($title); } else { - $url = "http://$lang.wikipedia.org/w/wiki.phtml?title=" . urlencode($title) . + $url = $URLFirstPart . urlencode($title) . "&diff=0&oldid=$lastid"; } - $boldTitle = $fmB . str_replace("_", " ", $title) . $fmB; + $title = str_replace("_", " ", $title); + # see http://www.irssi.org/?page=docs&doc=formats for some colour codes. prefix is \003, + # no colour (\003) switches back to the term default + $fullString = "\00303$title\0037 $flag\00310 $url \0037*\003 $user \0037*\003 $comment\n"; - if ( $patterns ) { - foreach ( $patterns as $pattern ) { - if ( preg_match( $pattern, $comment ) ) { - print chr(7); - break; - } - } - } - if ( $comment !== "" ) { - $comment = "($comment)"; - } - - $fullString = "$boldTitle $flag $url $user $comment\n"; - - if ( $fullString{0} == "/" ) { - $fullString = " $fullString"; - } print( $fullString ); $oldTimestamp = $row->rc_timestamp; sleep(2);