* @ingroup Maintenance
*/
+use MediaWiki\Config\ServiceOptions;
+use MediaWiki\Logger\LoggerFactory;
+use MediaWiki\MediaWikiServices;
+
require_once __DIR__ . '/Maintenance.php';
/**
}
public function execute() {
- global $wgLocalisationCacheConf;
+ global $wgLocalisationCacheConf, $wgCacheDirectory;
$force = $this->hasOption( 'force' );
$threads = $this->getOption( 'threads', 1 );
$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();
+ } ]
+ );
$allCodes = array_keys( Language::fetchLanguageNames( null, 'mwfile' ) );
if ( $this->hasOption( 'lang' ) ) {