From: Alexandre Emsenhuber Date: Sat, 2 Jul 2011 15:10:39 +0000 (+0000) Subject: The User object parameter of WikiPage::doRollback() and WikiPage::commitRollback... X-Git-Tag: 1.31.0-rc.0~29103 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=70dbd60d7e88f01e0f14132c13de36287dd14e03;p=lhc%2Fweb%2Fwiklou.git The User object parameter of WikiPage::doRollback() and WikiPage::commitRollback() was not passed by the Article implementation because it was not present. While I'm a it, WikiPage::doRollback() and WikiPage::commitRollback() now require that parameter, moved the check to Article. --- diff --git a/includes/Article.php b/includes/Article.php index 8f141e663b..716713937d 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -2068,12 +2068,16 @@ class Article extends Page { return $this->mPage->doDeleteArticle( $reason, $suppress, $id, $commit, $error ); } - public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails ) { - return $this->mPage->doRollback( $fromP, $summary, $token, $bot, $resultDetails ); + public function doRollback( $fromP, $summary, $token, $bot, &$resultDetails, User $user = null ) { + global $wgUser; + $user = is_null( $user ) ? $wgUser : $user; + return $this->mPage->doRollback( $fromP, $summary, $token, $bot, $resultDetails, $user ); } - public function commitRollback( $fromP, $summary, $bot, &$resultDetails ) { - return $this->mPage->commitRollback( $fromP, $summary, $bot, $resultDetails ); + public function commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser = null ) { + global $wgUser; + $guser = is_null( $guser ) ? $wgUser : $guser; + return $this->mPage->commitRollback( $fromP, $summary, $bot, $resultDetails, $guser ); } // ****** B/C functions for static methods ( __callStatic is PHP>=5.3 ) ****** // diff --git a/includes/WikiPage.php b/includes/WikiPage.php index db6c1ece80..da47145476 100644 --- a/includes/WikiPage.php +++ b/includes/WikiPage.php @@ -1694,11 +1694,8 @@ class WikiPage extends Page { * OutputPage::showPermissionsErrorPage(). */ public function doRollback( - $fromP, $summary, $token, $bot, &$resultDetails, User $user = null + $fromP, $summary, $token, $bot, &$resultDetails, User $user ) { - global $wgUser; - $user = is_null( $user ) ? $wgUser : $user; - $resultDetails = null; # Check permissions @@ -1737,9 +1734,8 @@ class WikiPage extends Page { * @param $resultDetails Array: contains result-specific array of additional values * @param $guser User The user performing the rollback */ - public function commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser = null ) { - global $wgUseRCPatrol, $wgUser, $wgContLang; - $guser = is_null( $guser ) ? $wgUser : $guser; + public function commitRollback( $fromP, $summary, $bot, &$resultDetails, User $guser ) { + global $wgUseRCPatrol, $wgContLang; $dbw = wfGetDB( DB_MASTER );