jobqueue: Remove duplicate property from DoubleRedirectJob
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Fri, 17 May 2019 15:08:36 +0000 (17:08 +0200)
committerThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Fri, 17 May 2019 15:08:36 +0000 (17:08 +0200)
All the stuff that is passed as $params to the constructor is stored
in $this->params anyway.

Change-Id: Idec1c243de7cdbb1e55dd754555536ce0ec2024d

includes/jobqueue/jobs/DoubleRedirectJob.php

index 1bcbd30..2c2cf89 100644 (file)
@@ -29,10 +29,6 @@ use MediaWiki\MediaWikiServices;
  * @ingroup JobQueue
  */
 class DoubleRedirectJob extends Job {
-       /** @var string Reason for the change, 'maintenance' or 'move'. Suffix fo
-        *    message key 'double-redirect-fixed-'.
-        */
-       private $reason;
 
        /** @var Title The title which has changed, redirects pointing to this
         *    title are fixed
@@ -44,11 +40,15 @@ class DoubleRedirectJob extends Job {
 
        /**
         * @param Title $title
-        * @param array $params
+        * @param array $params Expected to contain these elements:
+        * - 'redirTitle' => string The title that changed and should be fixed.
+        * - 'reason' => string Reason for the change, can be "move" or "maintenance". Used as a suffix
+        *   for the message keys "double-redirect-fixed-move" and
+        *   "double-redirect-fixed-maintenance".
+        * ]
         */
        function __construct( Title $title, array $params ) {
                parent::__construct( 'fixDoubleRedirect', $title, $params );
-               $this->reason = $params['reason'];
                $this->redirTitle = Title::newFromText( $params['redirTitle'] );
        }
 
@@ -166,7 +166,7 @@ class DoubleRedirectJob extends Job {
                $article = WikiPage::factory( $this->title );
 
                // Messages: double-redirect-fixed-move, double-redirect-fixed-maintenance
-               $reason = wfMessage( 'double-redirect-fixed-' . $this->reason,
+               $reason = wfMessage( 'double-redirect-fixed-' . $this->params['reason'],
                        $this->redirTitle->getPrefixedText(), $newTitle->getPrefixedText()
                )->inContentLanguage()->text();
                $flags = EDIT_UPDATE | EDIT_SUPPRESS_RC | EDIT_INTERNAL;