2 ini_set( "display_errors", 1 );
3 $wgCommandLineMode = true;
7 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
11 putenv( "wikilang=$lang");
12 $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php";
13 $newpath = "/apache/common/php$sep";
15 $settingsFile = "../LocalSettings.php";
20 $patterns = explode( ",", $argv[2]);
25 if ( ! is_readable( $settingsFile ) ) {
26 print "A copy of your installation's LocalSettings.php\n" .
27 "must exist in the source directory.\n";
31 ini_set( "include_path", "$newpath$IP$sep$include_path" );
33 $wgCommandLineMode = true;
35 include_once( $settingsFile );
36 include_once( "Setup.php" );*/
38 require_once("../maintenance/liveCmdLine.inc" );
40 $wgTitle = Title
::newFromText( "RC dumper" );
41 $wgCommandLineMode = true;
46 $res = wfQuery( "SELECT rc_timestamp FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1", DB_READ
);
47 $row = wfFetchObject( $res );
48 $oldTimestamp = $row->rc_timestamp
;
52 $res = wfQuery( "SELECT * FROM recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp", DB_READ
);
54 while ( $row = wfFetchObject( $res ) ) {
55 if ( ++
$serverCount %
20 == 0 ) {
56 print "/server irc.freenode.net\n";
58 $ns = $wgLang->getNsText( $row->rc_namespace
) ;
60 $title = "$ns:{$row->rc_title}";
62 $title = $row->rc_title
;
64 /*if ( strlen( $row->rc_comment ) > 50 ) {
65 $comment = substr( $row->rc_comment, 0, 50 );
67 $comment = $row->rc_comment
;
69 $bad = array("\n", "\r");
70 $empty = array("", "");
71 $comment = str_replace($bad, $empty, $comment);
72 $title = str_replace($bad, $empty, $title);
73 $user = str_replace($bad, $empty, $row->rc_user_text
);
74 $lastid = IntVal($row->rc_last_oldid
);
75 $flag = ($row->rc_minor ?
"M" : "") . ($row->rc_new ?
"N" : "");
77 $url = "http://$lang.wikipedia.org/wiki/" . urlencode($title);
79 $url = "http://$lang.wikipedia.org/w/wiki.phtml?title=" . urlencode($title) .
80 "&diff=0&oldid=$lastid";
82 $boldTitle = $fmB . str_replace("_", " ", $title) . $fmB;
85 foreach ( $patterns as $pattern ) {
86 if ( preg_match( $pattern, $comment ) ) {
92 if ( $comment !== "" ) {
93 $comment = "($comment)";
96 $fullString = "$boldTitle $flag $url $user $comment\n";
98 if ( $fullString{0} == "/" ) {
99 $fullString = " $fullString";
101 print( $fullString );
102 $oldTimestamp = $row->rc_timestamp
;