3 $wgCommandLineMode = true;
5 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ?
";" : ":";
8 $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php";
9 $newpath = "/apache/common/php$sep";
11 $settingsFile = "../LocalSettings.php";
16 print $argv[2] . "\n";
17 $patterns = explode( ",", $argv[2]);
22 if ( ! is_readable( $settingsFile ) ) {
23 print "A copy of your installation's LocalSettings.php\n" .
24 "must exist in the source directory.\n";
28 $wgCommandLineMode = true;
30 include_once( $settingsFile );
32 ini_set( "include_path", "$newpath$IP$sep$include_path" );
34 include_once( "Setup.php" );
35 $wgTitle = Title
::newFromText( "RC dumper" );
36 $wgCommandLineMode = true;
39 $res = wfQuery( "SELECT rc_timestamp FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1", DB_READ
);
40 $row = wfFetchObject( $res );
41 $oldTimestamp = $row->rc_timestamp
;
44 $res = wfQuery( "SELECT * FROM recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp", DB_READ
);
45 while ( $row = wfFetchObject( $res ) ) {
46 $ns = $wgLang->getNsText( $row->rc_namespace
) ;
48 $title = "$ns:{$row->rc_title}";
50 $title = $row->rc_title
;
52 /*if ( strlen( $row->rc_comment ) > 50 ) {
53 $comment = substr( $row->rc_comment, 0, 50 );
55 $comment = $row->rc_comment
;
57 $bad = array("\n", "\r");
58 $empty = array("", "");
59 $comment = str_replace($bad, $empty, $comment);
60 $title = str_replace($bad, $empty, $title);
61 $user = str_replace($bad, $empty, $row->rc_user_text
);
62 $url = "http://$lang.wikipedia.org/wiki/" . urlencode($title);
65 foreach ( $patterns as $pattern ) {
66 if ( preg_match( $pattern, $comment ) ) {
72 print( "$url ($user) $comment\n" );
73 $oldTimestamp = $row->rc_timestamp
;