diff options
Diffstat (limited to 'includes/job/DoubleRedirectJob.php')
-rw-r--r-- | includes/job/DoubleRedirectJob.php | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/includes/job/DoubleRedirectJob.php b/includes/job/DoubleRedirectJob.php index 2b7cd7c8..08af9975 100644 --- a/includes/job/DoubleRedirectJob.php +++ b/includes/job/DoubleRedirectJob.php @@ -1,6 +1,21 @@ <?php /** - * Job to fix double redirects after moving a page + * Job to fix double redirects after moving a page. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * http://www.gnu.org/copyleft/gpl.html * * @file * @ingroup JobQueue @@ -21,7 +36,7 @@ class DoubleRedirectJob extends Job { /** * Insert jobs into the job queue to fix redirects to the given title - * @param $reason String: the reason for the fix, see message double-redirect-fixed-<reason> + * @param $reason String: the reason for the fix, see message "double-redirect-fixed-<reason>" * @param $redirTitle Title: the title which has changed, redirects pointing to this title are fixed * @param $destTitle bool Not used */ @@ -74,7 +89,7 @@ class DoubleRedirectJob extends Job { return false; } - $targetRev = Revision::newFromTitle( $this->title ); + $targetRev = Revision::newFromTitle( $this->title, false, Revision::READ_LATEST ); if ( !$targetRev ) { wfDebug( __METHOD__.": target redirect already deleted, ignoring\n" ); return true; @@ -126,8 +141,9 @@ class DoubleRedirectJob extends Job { $oldUser = $wgUser; $wgUser = $this->getUser(); $article = WikiPage::factory( $this->title ); - $reason = wfMsgForContent( 'double-redirect-fixed-' . $this->reason, - $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText() ); + $reason = wfMessage( 'double-redirect-fixed-' . $this->reason, + $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText() + )->inContentLanguage()->text(); $article->doEdit( $newText, $reason, EDIT_UPDATE | EDIT_SUPPRESS_RC, false, $this->getUser() ); $wgUser = $oldUser; @@ -139,7 +155,7 @@ class DoubleRedirectJob extends Job { * * @param $title Title * - * @return false if the specified title is not a redirect, or if it is a circular redirect + * @return bool if the specified title is not a redirect, or if it is a circular redirect */ public static function getFinalDestination( $title ) { $dbw = wfGetDB( DB_MASTER ); @@ -179,7 +195,7 @@ class DoubleRedirectJob extends Job { */ function getUser() { if ( !self::$user ) { - self::$user = User::newFromName( wfMsgForContent( 'double-redirect-fixer' ), false ); + self::$user = User::newFromName( wfMessage( 'double-redirect-fixer' )->inContentLanguage()->text(), false ); # FIXME: newFromName could return false on a badly configured wiki. if ( !self::$user->isLoggedIn() ) { self::$user->addToDatabase(); |