X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fupdate.php;h=b6c7ae473b1861e4b4f58e30b53dcbe5edfbdc2f;hb=60fbf0d875c27dc6608c97ce1f96e1df3d88b788;hp=c780b6ae6b4eee949cdf9883ac16a422eef28144;hpb=16c80e429be5904fb42a93f260f8de3d18f0c692;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/update.php b/maintenance/update.php index c780b6ae6b..b6c7ae473b 100755 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -64,7 +64,7 @@ class UpdateMediaWiki extends Maintenance { function compatChecks() { $minimumPcreVersion = Installer::MINIMUM_PCRE_VERSION; - list( $pcreVersion ) = explode( ' ', PCRE_VERSION, 2 ); + $pcreVersion = explode( ' ', PCRE_VERSION, 2 )[0]; if ( version_compare( $pcreVersion, $minimumPcreVersion, '<' ) ) { $this->fatalError( "PCRE $minimumPcreVersion or later is required.\n" . @@ -85,7 +85,7 @@ class UpdateMediaWiki extends Maintenance { } function execute() { - global $wgVersion, $wgLang, $wgAllowSchemaUpdates; + global $wgVersion, $wgLang, $wgAllowSchemaUpdates, $wgMessagesDirs; if ( !$wgAllowSchemaUpdates && !( $this->hasOption( 'force' ) @@ -111,6 +111,9 @@ class UpdateMediaWiki extends Maintenance { } } + // T206765: We need to load the installer i18n files as some of errors come installer/updater code + $wgMessagesDirs['MediawikiInstaller'] = dirname( __DIR__ ) . '/includes/installer/i18n'; + $lang = Language::factory( 'en' ); // Set global language to ensure localised errors are in English (T22633) RequestContext::getMain()->setLanguage( $lang ); @@ -239,6 +242,24 @@ class UpdateMediaWiki extends Maintenance { 'manualRecache' => false, ]; } + + public function validateParamsAndArgs() { + // Allow extensions to add additional params. + $params = []; + Hooks::run( 'MaintenanceUpdateAddParams', [ &$params ] ); + foreach ( $params as $name => $param ) { + $this->addOption( + $name, + $param['desc'], + $param['require'] ?? false, + $param['withArg'] ?? false, + $param['shortName'] ?? false, + $param['multiOccurrence'] ?? false + ); + } + + parent::validateParamsAndArgs(); + } } $maintClass = UpdateMediaWiki::class;