aboutsummaryrefslogtreecommitdiffstats
path: root/irc
diff options
context:
space:
mode:
authorJerome Jamnicky <jeronim@users.mediawiki.org>2004-07-06 00:25:10 +0000
committerJerome Jamnicky <jeronim@users.mediawiki.org>2004-07-06 00:25:10 +0000
commitb2a010ac33bbfdc4574e64b793643dd6537339cf (patch)
tree16fc3b2ca0633c99600a2f554d017f9541dd3d90 /irc
parent1082447248e0057a4f0b85e1cdc3fec083f1d483 (diff)
downloadmediawikicore-b2a010ac33bbfdc4574e64b793643dd6537339cf.tar.gz
mediawikicore-b2a010ac33bbfdc4574e64b793643dd6537339cf.zip
Some updates to make it friendlier to non-Wikimedia sites.
Removed obsolete code and $patterns. Changed include to commandLine.inc from the obsolete liveCmdline.inc.
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/4241
Diffstat (limited to 'irc')
-rw-r--r--irc/rcdumper.php66
1 files changed, 25 insertions, 41 deletions
diff --git a/irc/rcdumper.php b/irc/rcdumper.php
index 0c8077589410..76ff91db8af5 100644
--- a/irc/rcdumper.php
+++ b/irc/rcdumper.php
@@ -1,41 +1,33 @@
<?php
-ini_set( "display_errors", 1 );
-$wgCommandLineMode = true;
-$fmB = chr(2);
-$fmU = chr(31);
+
/*
-$sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
-if ( $argv[1] ) {
- $lang = $argv[1];
- $site = "wikipedia";
- putenv( "wikilang=$lang");
- $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php";
- $newpath = "/apache/common/php$sep";
-} else {
- $settingsFile = "../LocalSettings.php";
- $newpath = "";
-}
+Example command-line:
+ php rcdumper.php | irc -d -c \#channel-to-join nick-of-bot some.irc.server
+where irc is the name of the ircII executable.
+The name of the the IRC should match $ircServer below.
+*/
-if ( $argv[2] ) {
- $patterns = explode( ",", $argv[2]);
-} else {
- $patterns = false;
-}
+$ircServer = "irc.freenode.net";
-if ( ! is_readable( $settingsFile ) ) {
- print "A copy of your installation's LocalSettings.php\n" .
- "must exist in the source directory.\n";
- exit();
-}
+# Set the below if this is running on a non-Wikimedia site:
+#$serverName="your.site.here";
-ini_set( "include_path", "$newpath$IP$sep$include_path" );
+ini_set( "display_errors", 1 );
$wgCommandLineMode = true;
-$DP = "../includes";
-include_once( $settingsFile );
-include_once( "Setup.php" );*/
+$fmB = chr(2);
+$fmU = chr(31);
-require_once("../maintenance/liveCmdLine.inc" );
+require_once("../maintenance/commandLine.inc" );
+
+if ($wgWikiFarm) {
+ $serverName="$lang.wikipedia.org";
+ $newPageURLFirstPart="http://$serverName/wiki/";
+ $URLFirstPart="http://$serverName/w/wiki.phtml?title=";
+} else {
+ $newPageURLFirstPart="http://$serverName$wgScript/";
+ $URLFirstPart="http://$serverName$wgScript?title=";
+}
$wgTitle = Title::newFromText( "RC dumper" );
$wgCommandLineMode = true;
@@ -53,7 +45,7 @@ while (1) {
$rowIndex = 0;
while ( $row = wfFetchObject( $res ) ) {
if ( ++$serverCount % 20 == 0 ) {
- print "/server irc.freenode.net\n";
+ print "/server $ircServer\n";
}
$ns = $wgLang->getNsText( $row->rc_namespace ) ;
if ( $ns ) {
@@ -74,21 +66,13 @@ while (1) {
$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);
+ $url = $newPageURLFirstPart . urlencode($title);
} else {
- $url = "http://$lang.wikipedia.org/w/wiki.phtml?title=" . urlencode($title) .
+ $url = $URLFirstPart . 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)";
}