diff --git a/action_functions.php b/action_functions.php index 3e763bc..2b7165e 100644 --- a/action_functions.php +++ b/action_functions.php @@ -25,6 +25,7 @@ class Action { public static function doWarn($change, $report) { + global $logger; $warning = self::getWarningLevel($change['user'], $tpcontent) + 1; if (!Config::$dry) { if ($warning >= 4) { @@ -32,7 +33,7 @@ public static function doWarn($change, $report) self::aiv($change, $report); } else { /* Warn them if they haven't been warned 4 times. */ - IRC::debug("Warning " . $change['user'] . " (" . $warning . ")"); + $logger->addInfo("Warning " . $change['user'] . " (" . $warning . ")"); self::warn($change, $report, $tpcontent, $warning); } } @@ -74,9 +75,10 @@ public static function getWarningLevel($user, &$content = null) private static function aiv($change, $report) { + global $logger; $aivdata = Api::$q->getpage('Wikipedia:Administrator_intervention_against_vandalism/TB2'); if (!preg_match('/' . preg_quote($change['user'], '/') . '/i', $aivdata)) { - IRC::debug( + $logger->addInfo( '!admin Reporting [[User:' . $change['user'] . ']] to [[WP:AIV]]. Contributions: [[Special:Contributions/' . $change['user'] . ']] Block: [[Special:Blockip/' . $change['user'] . ']]' @@ -153,6 +155,7 @@ public static function doRevert($change) public static function shouldRevert($change) { + global $logger; $reason = 'Default revert'; if (preg_match('/(assisted|manual)/iS', Config::$status)) { echo 'Revert [y/N]? '; @@ -198,7 +201,7 @@ public static function shouldRevert($change) return array(true, 'Angry-reverting on TFA'); } if (preg_match('/\* \[\[(' . preg_quote($change['title'], '/') . ')\]\] \- .*/i', Globals::$aoptin)) { - IRC::debug('Angry-reverting [[' . $change['title'] . ']].'); + $logger->addInfo('Angry-reverting [[' . $change['title'] . ']].'); return array(true, 'Angry-reverting on angry-optin'); } diff --git a/cbng.php b/cbng.php index 25ce6e7..3bc0682 100644 --- a/cbng.php +++ b/cbng.php @@ -206,8 +206,6 @@ function parseFeedData($feedData, $useOld = false) and isset($api['revisions'][1]['*'])) ) { $logger->addError("Failed to get all edit info: " . var_export($feedData, true) . ", " . var_export($cb, true)); - IRC::debug("Failed to get edit info for \x0315[[\x0307" . $feedData['title'] . "\x0315]] " . - "by \"\x0303" . $feedData['user'] . "\x0315\" (\x0312 " . $feedData['url'] . " \x0315)"); return false; } $data = array( diff --git a/cluebot-ng.config.php.dist b/cluebot-ng.config.php.dist index e4ea5be..2a26fc7 100644 --- a/cluebot-ng.config.php.dist +++ b/cluebot-ng.config.php.dist @@ -36,7 +36,6 @@ namespace CluebotNG; public static $cb_mysql_user = ''; public static $cb_mysql_pass = ''; public static $cb_mysql_db = 'cb'; - public static $udpport = 3334; public static $coreport = 3565; public static $fork = true; public static $dry = false; diff --git a/feed_functions.php b/feed_functions.php index 0b2416e..1df732d 100644 --- a/feed_functions.php +++ b/feed_functions.php @@ -148,6 +148,7 @@ private static function loop($line) public static function bail($change, $why = '', $score = 'N/A', $reverted = false) { + global $logger; $rchange = $change; $rchange['edit_reason'] = $why; $rchange['edit_score'] = $score; diff --git a/irc_functions.php b/irc_functions.php index 16cd72b..834a532 100644 --- a/irc_functions.php +++ b/irc_functions.php @@ -104,35 +104,4 @@ public static function init() } self::$chans = $tmp; } - - public static function debug($message) - { - return self::message('#wikipedia-en-cbngdebug', $message); - } - - public static function spam($message) - { - return self::message('#wikipedia-en-cbngfeed', $message); - } - - public static function revert($message) - { - return self::message('#wikipedia-en-cbngrevertfeed', $message); - } - - private static function message($channel, $message) - { - global $logger; - $relay_node = Db::getCurrentRelayNode(); - if (!isset($relay_node)) { - $logger->addError("Could not get relay node. Failed to send: " . $message); - return; - } - $logger->addInfo('Saying to ' . $channel . ': ' . $message); - $udp = fsockopen('udp://' . $relay_node, Config::$udpport); - if ($udp !== false) { - fwrite($udp, $channel . ':' . $message); - fclose($udp); - } - } } diff --git a/process_functions.php b/process_functions.php index 0cf6fab..df5030d 100644 --- a/process_functions.php +++ b/process_functions.php @@ -105,8 +105,8 @@ public static function processEditThread($change) } $oftVand[$change['title']][] = time(); file_put_contents('oftenvandalized.txt', serialize($oftVand)); - $ircreport = "\x0315[[\x0307" . $change['title'] . "\x0315]] by \"\x0303" . $change['user'] . - "\x0315\" (\x0312 " . $change['url'] . " \x0315) \x0306" . $s . "\x0315 ("; + $ircreport = "[[" . $change['title'] . "]] by \"" . $change['user'] . + "\" (" . $change['url'] . " )" . $s . " ("; $change['mysqlid'] = Db::detectedVandalism( $change['user'], $change['title'], @@ -123,9 +123,9 @@ public static function processEditThread($change) $rbret = Action::doRevert($change); if ($rbret !== false) { $change['edit_status'] = 'reverted'; - IRC::revert( - $ircreport . "\x0304Reverted\x0315) (\x0313" . $revertReason . - "\x0315) (\x0302" . (microtime(true) - $change['startTime']) . " \x0315s)" + $logger->addInfo( + $ircreport . "Reverted) (" . $revertReason . + ") (" . (microtime(true) - $change['startTime']) . " s)" ); Action::doWarn($change, $report); Db::vandalismReverted($change['mysqlid']); @@ -134,9 +134,9 @@ public static function processEditThread($change) $change['edit_status'] = 'beaten'; $rv2 = Api::$a->revisions($change['title'], 1); if ($change['user'] != $rv2[0]['user']) { - IRC::revert( - $ircreport . "\x0303Not Reverted\x0315) (\x0313Beaten by " . - $rv2[0]['user'] . "\x0315) (\x0302" . (microtime(true) - $change['startTime']) . " \x0315s)" + $logger->addInfo( + $ircreport . "Not Reverted) (Beaten by " . + $rv2[0]['user'] . ") (" . (microtime(true) - $change['startTime']) . " s)" ); Db::vandalismRevertBeaten($change['mysqlid'], $change['title'], $rv2[0]['user'], $change['url']); Feed::bail($change, 'Beaten by ' . $rv2[0]['user'], $s);