Page MenuHomePhabricator

Should addWiki call setDB
Closed, ResolvedPublic

Description

Following up on T197863, we run addWiki with --wiki=aawiki (hack we know)

But when we run child scripts, we don't do anything for changing the db... So they're going to be running against aawiki?

		// Sets up the filebackend zones
		$setZones = $this->runChild(
			'SetZoneAccess',
			"$IP/extensions/WikimediaMaintenance/filebackend/setZoneAccess.php"
		);

		$setZones->mOptions['backend'] = 'local-multiwrite';
		if ( $this->isPrivate( $dbName ) ) {
			$setZones->mOptions['private'] = 1;
		}
		$setZones->execute();

If we look at runChild

	public function runChild( $maintClass, $classFile = null ) {
		// Make sure the class is loaded first
		if ( !class_exists( $maintClass ) ) {
			if ( $classFile ) {
				require_once $classFile;
			}
			if ( !class_exists( $maintClass ) ) {
				$this->error( "Cannot spawn child: $maintClass" );
			}
		}

		/**
		 * @var $child Maintenance
		 */
		$child = new $maintClass();
		$child->loadParamsAndArgs( $this->mSelf, $this->mOptions, $this->mArgs );
		if ( !is_null( $this->mDb ) ) {
			$child->setDB( $this->mDb );
		}

		return $child;
	}

It checks if mDb has been set to something, and alters the child to match..

The Cirrus Scripts handle this differently (fine)...

$searchIndex->mOptions[ 'baseName' ] = $dbName;

But the other scripts... Do not? Potentially affecting Wikidata and Cognate too

Event Timeline

Change 450221 had a related patch set uploaded (by Reedy; owner: Reedy):
[mediawiki/extensions/WikimediaMaintenance@master] Call ->setDB() in various places

https://gerrit.wikimedia.org/r/450221

Change 450221 merged by jenkins-bot:
[mediawiki/extensions/WikimediaMaintenance@master] Call ->setDB() in various places

https://gerrit.wikimedia.org/r/450221

Reedy claimed this task.
Reedy removed a project: Patch-For-Review.