From: Daniel Cannon Date: Thu, 10 Jan 2008 09:54:35 +0000 (+0000) Subject: * (bug 12574) Allow bots to specify whether an edit should be marked as a bot X-Git-Tag: 1.31.0-rc.0~50074 X-Git-Url: https://git.heureux-cyclage.org/?a=commitdiff_plain;h=bd7eafea2027a9dee5cfeee4cc81fd2483b702bd;p=lhc%2Fweb%2Fwiklou.git * (bug 12574) Allow bots to specify whether an edit should be marked as a bot edit, via the parameter 'bot'. (Default: '1') Patch by Cobi . --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fa39373945..69b8fe3ba9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -122,6 +122,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * When submitting changes on Special:Userrights, show the full form again, not just the search box. * Added exception hooks +* (bug 12574) Allow bots to specify whether an edit should be marked as a bot + edit, via the parameter 'bot'. (Default: '1') === Bug fixes in 1.12 === diff --git a/includes/Article.php b/includes/Article.php index 473e01d4cc..bca4461392 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -1298,7 +1298,7 @@ class Article { * @return bool success */ function doEdit( $text, $summary, $flags = 0 ) { - global $wgUser, $wgDBtransactions; + global $wgUser, $wgDBtransactions, $wgRequest; wfProfileIn( __METHOD__ ); $good = true; @@ -1323,7 +1323,7 @@ class Article { # Silently ignore EDIT_MINOR if not allowed $isminor = ( $flags & EDIT_MINOR ) && $wgUser->isAllowed('minoredit'); - $bot = $wgUser->isAllowed( 'bot' ) || ( $flags & EDIT_FORCE_BOT ); + $bot = ( $wgUser->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot' , true ) : 0 ) || ( $flags & EDIT_FORCE_BOT ); $oldtext = $this->getContent(); $oldsize = strlen( $oldtext ); @@ -2280,7 +2280,7 @@ class Article { * @return self::SUCCESS on succes, self::* on failure */ public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails ) { - global $wgUser, $wgUseRCPatrol; + global $wgUser, $wgUseRCPatrol, $wgRequest; $resultDetails = null; # Just in case it's being called from elsewhere @@ -2368,7 +2368,7 @@ class Article { if ($wgUser->isAllowed('minoredit')) $flags |= EDIT_MINOR; - if( $bot ) + if( $bot && $wgRequest->getBool( 'bot' , true ) ) $flags |= EDIT_FORCE_BOT; $this->doEdit( $target->getText(), $summary, $flags ); diff --git a/includes/RecentChange.php b/includes/RecentChange.php index 41af45acdb..2db82ca362 100644 --- a/includes/RecentChange.php +++ b/includes/RecentChange.php @@ -262,8 +262,13 @@ class RecentChange $newId = 0) { + global $wgRequest; + if ( $bot === 'default' ) { $bot = $user->isAllowed( 'bot' ); + if ( $bot ) { + $bot = $wgRequest->getBool( 'bot' , true ); + } } if ( !$ip ) { @@ -315,6 +320,8 @@ class RecentChange public static function notifyNew( $timestamp, &$title, $minor, &$user, $comment, $bot = 'default', $ip='', $size = 0, $newId = 0 ) { + global $wgRequest; + if ( !$ip ) { $ip = wfGetIP(); if ( !$ip ) { @@ -323,6 +330,9 @@ class RecentChange } if ( $bot === 'default' ) { $bot = $user->isAllowed( 'bot' ); + if ( $bot ) { + $bot = $wgRequest->getBool( 'bot' , true ); + } } $rc = new RecentChange; @@ -362,6 +372,8 @@ class RecentChange # Makes an entry in the database corresponding to a rename public static function notifyMove( $timestamp, &$oldTitle, &$newTitle, &$user, $comment, $ip='', $overRedir = false ) { + global $wgRequest; + if ( !$ip ) { $ip = wfGetIP(); if ( !$ip ) { @@ -383,7 +395,7 @@ class RecentChange 'rc_comment' => $comment, 'rc_this_oldid' => 0, 'rc_last_oldid' => 0, - 'rc_bot' => $user->isAllowed( 'bot' ) ? 1 : 0, + 'rc_bot' => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot' , true ) : 0, 'rc_moved_to_ns' => $newTitle->getNamespace(), 'rc_moved_to_title' => $newTitle->getDBkey(), 'rc_ip' => $ip, @@ -414,6 +426,8 @@ class RecentChange public static function notifyLog( $timestamp, &$title, &$user, $comment, $ip='', $type, $action, $target, $logComment, $params ) { + global $wgRequest; + if ( !$ip ) { $ip = wfGetIP(); if ( !$ip ) { @@ -435,7 +449,7 @@ class RecentChange 'rc_comment' => $comment, 'rc_this_oldid' => 0, 'rc_last_oldid' => 0, - 'rc_bot' => $user->isAllowed( 'bot' ) ? 1 : 0, + 'rc_bot' => $user->isAllowed( 'bot' ) ? $wgRequest->getBool( 'bot' , true ) : 0, 'rc_moved_to_ns' => 0, 'rc_moved_to_title' => '', 'rc_ip' => $ip,