3 $wgCommandLineMode = true;
7 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ?
";" : ":";
10 putenv( "wikilang=$lang");
11 $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php";
12 $newpath = "/apache/common/php$sep";
14 $settingsFile = "../LocalSettings.php";
19 $patterns = explode( ",", $argv[2]);
24 if ( ! is_readable( $settingsFile ) ) {
25 print "A copy of your installation's LocalSettings.php\n" .
26 "must exist in the source directory.\n";
30 ini_set( "include_path", "$newpath$IP$sep$include_path" );
32 $wgCommandLineMode = true;
34 include_once( $settingsFile );
35 include_once( "Setup.php" );
36 $wgTitle = Title
::newFromText( "RC dumper" );
37 $wgCommandLineMode = true;
42 $res = wfQuery( "SELECT rc_timestamp FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1", DB_READ
);
43 $row = wfFetchObject( $res );
44 $oldTimestamp = $row->rc_timestamp
;
47 $res = wfQuery( "SELECT * FROM recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp", DB_READ
);
49 while ( $row = wfFetchObject( $res ) ) {
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 = "http://$lang.wikipedia.org/wiki/" . urlencode($title);
71 $url = "http://$lang.wikipedia.org/w/wiki.phtml?title=" . urlencode($title) .
72 "&diff=0&oldid=$lastid";
74 $boldTitle = $fmB . str_replace("_", " ", $title) . $fmB;
77 foreach ( $patterns as $pattern ) {
78 if ( preg_match( $pattern, $comment ) ) {
84 if ( $comment !== "" ) {
85 $comment = "($comment)";
88 $fullString = "$boldTitle $flag $url $user $comment\n";
90 if ( $fullString{0} == "/" ) {
91 $fullString = " $fullString";
94 $oldTimestamp = $row->rc_timestamp
;