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 the IRC 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;
36 $res = wfQuery( "SELECT rc_timestamp FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1", DB_READ
);
37 $row = wfFetchObject( $res );
38 $oldTimestamp = $row->rc_timestamp
;
42 $res = wfQuery( "SELECT * FROM recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp", DB_READ
);
44 while ( $row = wfFetchObject( $res ) ) {
45 if ( ++
$serverCount %
20 == 0 ) {
46 print "/server $ircServer\n";
48 $ns = $wgLang->getNsText( $row->rc_namespace
) ;
50 $title = "$ns:{$row->rc_title}";
52 $title = $row->rc_title
;
54 /*if ( strlen( $row->rc_comment ) > 50 ) {
55 $comment = substr( $row->rc_comment, 0, 50 );
57 $comment = $row->rc_comment
;
59 $bad = array("\n", "\r");
60 $empty = array("", "");
61 $comment = str_replace($bad, $empty, $comment);
62 $title = str_replace($bad, $empty, $title);
63 $user = str_replace($bad, $empty, $row->rc_user_text
);
64 $lastid = IntVal($row->rc_last_oldid
);
65 $flag = ($row->rc_minor ?
"M" : "") . ($row->rc_new ?
"N" : "");
67 $url = $newPageURLFirstPart . urlencode($title);
69 $url = $URLFirstPart . urlencode($title) .
70 "&diff=0&oldid=$lastid";
72 $title = str_replace("_", " ", $title);
73 # see http://www.irssi.org/?page=docs&doc=formats for some colour codes. prefix is \003,
74 # no colour (\003) switches back to the term default
75 $fullString = "\0033$title \0037$flag \00310$url \0037*\003 $user \0037*\003 $comment\n";
77 if ( $fullString{0} == "/" ) {
78 $fullString = " $fullString";
81 $oldTimestamp = $row->rc_timestamp
;