The User object parameter of WikiPage::doRollback() and WikiPage::commitRollback...
authorAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 2 Jul 2011 15:10:39 +0000 (15:10 +0000)
committerAlexandre Emsenhuber <ialex@users.mediawiki.org>
Sat, 2 Jul 2011 15:10:39 +0000 (15:10 +0000)
While I'm a it, WikiPage::doRollback() and WikiPage::commitRollback() now require that parameter, moved the check to Article.

includes/Article.php
includes/WikiPage.php

index 8f141e6..7167139 100644 (file)
@@ -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 ) ****** //
index db6c1ec..da47145 100644 (file)
@@ -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 );