From: Tim Starling Date: Sat, 28 Feb 2004 01:54:34 +0000 (+0000) Subject: IRC script moved from maintenance directory X-Git-Tag: 1.3.0beta1~932 X-Git-Url: http://git.cyclocoop.org/%27.parametre_url%28%20%20%20generer_action_auteur%28%27charger_plugin%27%2C%20%27update_flux%27%29%2C%27update_flux%27%2C%20%27oui%27%29.%27?a=commitdiff_plain;h=60a91448d611a9ecb5e65dc4cf91c4f601d065a4;p=lhc%2Fweb%2Fwiklou.git IRC script moved from maintenance directory --- diff --git a/irc/rcdumper.php b/irc/rcdumper.php new file mode 100644 index 0000000000..0ba026cd79 --- /dev/null +++ b/irc/rcdumper.php @@ -0,0 +1,102 @@ +rc_timestamp; + +while (1) { + $res = wfQuery( "SELECT * FROM recentchanges WHERE rc_timestamp>'$oldTimestamp' ORDER BY rc_timestamp", DB_READ ); + $rowIndex = 0; + while ( $row = wfFetchObject( $res ) ) { + $ns = $wgLang->getNsText( $row->rc_namespace ) ; + if ( $ns ) { + $title = "$ns:{$row->rc_title}"; + } else { + $title = $row->rc_title; + } + /*if ( strlen( $row->rc_comment ) > 50 ) { + $comment = substr( $row->rc_comment, 0, 50 ); + } else {*/ + $comment = $row->rc_comment; +// } + $bad = array("\n", "\r"); + $empty = array("", ""); + $comment = str_replace($bad, $empty, $comment); + $title = str_replace($bad, $empty, $title); + $user = str_replace($bad, $empty, $row->rc_user_text); + $lastid = IntVal($row->rc_last_oldid); + $flag = ($row->rc_minor ? "M" : "") . ($row->rc_new ? "N" : ""); + if ( $row->rc_new ) { + $url = "http://$lang.wikipedia.org/wiki/" . urlencode($title); + } else { + $url = "http://$lang.wikipedia.org/w/wiki.phtml?title=" . urlencode($title) . + "&diff=0&oldid=$lastid"; + } + $boldTitle = $fmB . str_replace("_", " ", $title) . $fmB; + + if ( $patterns ) { + foreach ( $patterns as $pattern ) { + if ( preg_match( $pattern, $comment ) ) { + print chr(7); + break; + } + } + } + if ( $comment !== "" ) { + $comment = "($comment)"; + } + + $fullString = "$boldTitle $flag $url $user $comment\n"; + + if ( $fullString{0} == "/" ) { + $fullString = " $fullString"; + } + print( $fullString ); + $oldTimestamp = $row->rc_timestamp; + sleep(2); + } + sleep(5); +} + +exit(); + +?>