X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=maintenance%2FrebuildLocalisationCache.php;h=e5f799d7b37404de1152956e327e4c14046d5faa;hp=4213d5f85d9f97405ea74b7dcfb7348f6d406dea;hb=e65f8ac5110804067366f9f239c13f4f29b66c3d;hpb=7babd362babcbf7f20adb8e12edb4f4bc1d4249f diff --git a/maintenance/rebuildLocalisationCache.php b/maintenance/rebuildLocalisationCache.php index 4213d5f85d..e5f799d7b3 100644 --- a/maintenance/rebuildLocalisationCache.php +++ b/maintenance/rebuildLocalisationCache.php @@ -29,6 +29,10 @@ * @ingroup Maintenance */ +use MediaWiki\Config\ServiceOptions; +use MediaWiki\Logger\LoggerFactory; +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -58,7 +62,7 @@ class RebuildLocalisationCache extends Maintenance { } public function execute() { - global $wgLocalisationCacheConf; + global $wgLocalisationCacheConf, $wgCacheDirectory; $force = $this->hasOption( 'force' ); $threads = $this->getOption( 'threads', 1 ); @@ -77,13 +81,25 @@ class RebuildLocalisationCache extends Maintenance { $conf = $wgLocalisationCacheConf; $conf['manualRecache'] = false; // Allow fallbacks to create CDB files - if ( $force ) { - $conf['forceRecache'] = true; - } + $conf['forceRecache'] = $force || !empty( $conf['forceRecache'] ); if ( $this->hasOption( 'outdir' ) ) { $conf['storeDirectory'] = $this->getOption( 'outdir' ); } - $lc = new LocalisationCacheBulkLoad( $conf ); + // XXX Copy-pasted from ServiceWiring.php. Do we need a factory for this one caller? + $lc = new LocalisationCacheBulkLoad( + new ServiceOptions( + LocalisationCache::CONSTRUCTOR_OPTIONS, + $conf, + MediaWikiServices::getInstance()->getMainConfig() + ), + LocalisationCache::getStoreFromConf( $conf, $wgCacheDirectory ), + LoggerFactory::getInstance( 'localisation' ), + [ function () { + MediaWikiServices::getInstance()->getResourceLoader() + ->getMessageBlobStore()->clear(); + } ], + MediaWikiServices::getInstance()->getLanguageNameUtils() + ); $allCodes = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) ); if ( $this->hasOption( 'lang' ) ) {