5 php rcdumper.php | irc -d -c \#channel-to-join nick-of-bot some.irc.server
6 where irc is the name of the ircII executable.
7 The name of the IRC server should match $ircServer below.
10 $ircServer = "irc.freenode.net";
12 # Set the below if this is running on a non-Wikimedia site:
13 #$serverName="your.site.here";
16 ini_set( "display_errors", 1 );
17 $wgCommandLineMode = true;
19 require_once("../maintenance/commandLine.inc" );
22 $serverName="$lang.wikipedia.org";
23 $newPageURLFirstPart="http://$serverName/wiki/";
24 $URLFirstPart="http://$serverName/w/wiki.phtml?title=";
26 $newPageURLFirstPart="http://$serverName$wgScript/";
27 $URLFirstPart="http://$serverName$wgScript?title=";
30 $wgTitle = Title
::newFromText( "RC dumper" );
31 $wgCommandLineMode = true;
35 $dbr =& wfGetDB( DB_SLAVE
);
36 $recentchanges = $dbr->tableName( 'recentchanges' );
38 $res = $dbr->query( "SELECT rc_timestamp FROM $recentchanges ORDER BY rc_timestamp DESC LIMIT 1" );
39 $row = $dbr->fetchObject( $res );
40 $oldTimestamp = $row->rc_timestamp
;
44 $res = $dbr->query( "SELECT * FROM $recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp" );
46 while ( $row = $dbr->fetchObject( $res ) ) {
47 if ( ++
$serverCount %
20 == 0 ) {
48 print "/server $ircServer\n";
50 $ns = $wgLang->getNsText( $row->rc_namespace
) ;
52 $title = "$ns:{$row->rc_title}";
54 $title = $row->rc_title
;
56 /*if ( strlen( $row->rc_comment ) > 50 ) {
57 $comment = substr( $row->rc_comment, 0, 50 );
59 $comment = $row->rc_comment
;
61 $bad = array("\n", "\r");
62 $empty = array("", "");
63 $comment = str_replace($bad, $empty, $comment);
64 $title = str_replace($bad, $empty, $title);
65 $user = str_replace($bad, $empty, $row->rc_user_text
);
66 $lastid = IntVal($row->rc_last_oldid
);
67 $flag = ($row->rc_minor ?
"M" : "") . ($row->rc_new ?
"N" : "");
69 $url = $newPageURLFirstPart . urlencode($title);
71 $url = $URLFirstPart . urlencode($title) .
72 "&diff=0&oldid=$lastid";
74 $title = str_replace("_", " ", $title);
75 # see http://www.irssi.org/?page=docs&doc=formats for some colour codes. prefix is \003,
76 # no colour (\003) switches back to the term default
77 $fullString = "\00303$title\0037 $flag\00310 $url \0037*\003 $user \0037*\003 $comment\n";
80 $oldTimestamp = $row->rc_timestamp
;