Move lbFactory defintion from construct to execute in populateChangeTagDef
authorAmir Sarabadani <ladsgroup@gmail.com>
Mon, 18 Jun 2018 16:34:48 +0000 (18:34 +0200)
committerAmir Sarabadani <ladsgroup@gmail.com>
Mon, 18 Jun 2018 16:34:48 +0000 (18:34 +0200)
It seems the class doesn't load needed classes in construct so we get
Uncaught Error: Class 'MediaWiki\MediaWikiServices' not found

Bug: T193871
Change-Id: I0d6a49232cbc256a34ab49e8a4e41f6cc942fe4b

maintenance/populateChangeTagDef.php

index c815d8d..3b32c00 100644 (file)
@@ -24,7 +24,7 @@ require_once __DIR__ . '/Maintenance.php';
  * @ingroup Maintenance
  */
 class PopulateChangeTagDef extends Maintenance {
-       /** @var Wikimedia\Rdbms\LBFactory */
+       /** @var Wikimedia\Rdbms\ILBFactory */
        protected $lbFactory;
 
        public function __construct() {
@@ -38,11 +38,11 @@ class PopulateChangeTagDef extends Maintenance {
                        false,
                        true
                );
-               $this->lbFactory = MediaWiki\MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
        }
 
        public function execute() {
                global $wgChangeTagsSchemaMigrationStage;
+               $this->lbFactory = MediaWiki\MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
                $this->setBatchSize( $this->getOption( 'batch-size', $this->getBatchSize() ) );
 
                $this->countDown( 5 );