Page MenuHomePhabricator

Cognate broken in addWiki.php
Closed, ResolvedPublic

Description

Broke while doing T173643: Create Wiktionary Fiji Hindi

Getting sites.
Got 172 sites.
Inserting sites.
[c97ad8d44ce946d66c760e26] [no req]   MediaWiki\Services\NoSuchServiceException from line 364 of /srv/mediawiki/php-1.31.0-wmf.6/includes/services/ServiceContainer.php: No such service: CognateStore
Backtrace:
#0 /srv/mediawiki/php-1.31.0-wmf.6/includes/services/ServiceContainer.php(344): MediaWiki\Services\ServiceContainer->createService(string)
#1 /srv/mediawiki/php-1.31.0-wmf.6/extensions/Cognate/maintenance/populateCognateSites.php(46): MediaWiki\Services\ServiceContainer->getService(string)
#2 /srv/mediawiki/php-1.31.0-wmf.6/extensions/WikimediaMaintenance/addWiki.php(251): Cognate\PopulateCognateSites->execute()
#3 /srv/mediawiki/php-1.31.0-wmf.6/maintenance/doMaintenance.php(95): AddWiki->execute()
#4 /srv/mediawiki/php-1.31.0-wmf.6/extensions/WikimediaMaintenance/addWiki.php(365): require_once(string)
#5 /srv/mediawiki/multiversion/MWScript.php(99): require_once(string)
#6 {main}

Event Timeline

So the check is:

$site === 'wiktionary'

then run populateCognateSites.php

But it would seem that Cognate is not actually loaded as an extension for the wiki being created, hence the error.

However in InitialiseSettings.php

'wmgUseCognate' => [
	'default' => false,
	'wiktionary' => 'wiktionary', // T150182
],

I guess something here doesn't work as I expect?

Because we run the script as aawiki

Because we run the script as aawiki

Could we run it for wiktionaries as aawiktionary?

An alternative would be load the extension within this script?

An alternative would be load the extension within this script?

We can't really. Unless we copy pasta the config from CommonSettings for the extension too (and then risk it getting out of sync), we can't

Then I guess the only solution is to run it as aawiktionary? or any other wiktionary, so that the correct set of code will be loaded?

That, or run it as a separate script after

That, or run it as a separate script after

I would be pro keeping it in this script.
We could always add a check to the start

if ( $site === 'wiktionary' && currentWikiNotAWiktionary ){
    die( 'if you are trying to create a wiktionary please use aawiktionary as the wiki?' )
}

Change 391271 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/WikimediaMaintenance@master] Error if wiktionary creation attempted without using aawiktionary

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

Change 391271 merged by jenkins-bot:
[mediawiki/extensions/WikimediaMaintenance@master] Error if wiktionary creation attempted without using aawiktionary

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