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;
40 $res = wfQuery( "SELECT rc_timestamp FROM recentchanges ORDER BY rc_timestamp DESC LIMIT 1", DB_READ
);
41 $row = wfFetchObject( $res );
42 $oldTimestamp = $row->rc_timestamp
;
45 $res = wfQuery( "SELECT * FROM recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp", DB_READ
);
47 while ( $row = wfFetchObject( $res ) ) {
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 = "http://$lang.wikipedia.org/wiki/" . urlencode($title);
69 $url = "http://$lang.wikipedia.org/w/wiki.phtml?title=" . urlencode($title) .
70 "&diff=0&oldid=$lastid";
72 $boldTitle = $fmB . str_replace("_", " ", $title) . $fmB;
75 foreach ( $patterns as $pattern ) {
76 if ( preg_match( $pattern, $comment ) ) {
82 if ( $comment !== "" ) {
83 $comment = "($comment)";
86 $fullString = "$boldTitle $flag $url $user $comment\n";
88 if ( $fullString{0} == "/" ) {
89 $fullString = " $fullString";
92 $oldTimestamp = $row->rc_timestamp
;