X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=blobdiff_plain;f=maintenance%2Fupdate.php;h=d84ec5c54bfe1c64e6ba37e2bf385d5055a1ce34;hb=1cc50ab8f5f94c753781a875fa91e9fea7a9dcc9;hp=50fb6dc5033e86475a2e1e43ccd783cd8ff53803;hpb=58d70885d875a3928d96a2ca0a74dbc0ec5bb8bb;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/update.php b/maintenance/update.php index 50fb6dc503..d84ec5c54b 100755 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -28,6 +28,7 @@ require_once __DIR__ . '/Maintenance.php'; use Wikimedia\Rdbms\IMaintainableDatabase; +use Wikimedia\Rdbms\DatabaseSqlite; /** * Maintenance script to run database schema updates. @@ -64,7 +65,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" . @@ -123,6 +124,10 @@ class UpdateMediaWiki extends Maintenance { $this->output( "MediaWiki {$wgVersion} Updater\n\n" ); + foreach ( SpecialVersion::getSoftwareInformation() as $name => $version ) { + $this->output( "{$name}: {$version}\n" ); + } + wfWaitForSlaves(); if ( !$this->hasOption( 'skip-compat-checks' ) ) { @@ -156,7 +161,8 @@ class UpdateMediaWiki extends Maintenance { $this->fatalError( $text ); } - $this->output( "Going to run database updates for " . wfWikiID() . "\n" ); + $dbDomain = WikiMap::getCurrentWikiDbDomain()->getId(); + $this->output( "Going to run database updates for $dbDomain\n" ); if ( $db->getType() === 'sqlite' ) { /** @var IMaintainableDatabase|DatabaseSqlite $db */ $this->output( "Using SQLite file: '{$db->getDbFilePath()}'\n" ); @@ -243,18 +249,27 @@ class UpdateMediaWiki extends Maintenance { ]; } + /** + * @throws FatalError + * @throws MWException + * @suppress PhanPluginDuplicateConditionalNullCoalescing + */ public function validateParamsAndArgs() { // Allow extensions to add additional params. $params = []; Hooks::run( 'MaintenanceUpdateAddParams', [ &$params ] ); + + // This executes before the PHP version check, so don't use null coalesce (??). + // Keeping this compatible with older PHP versions lets us reach the code that + // displays a more helpful error. foreach ( $params as $name => $param ) { $this->addOption( $name, $param['desc'], - $param['require'] ?? false, - $param['withArg'] ?? false, - $param['shortName'] ?? false, - $param['multiOccurrence'] ?? false + isset( $param['require'] ) ? $param['require'] : false, + isset( $param['withArg'] ) ? $param['withArg'] : false, + isset( $param['shortName'] ) ? $param['shortName'] : false, + isset( $param['multiOccurrence'] ) ? $param['multiOccurrence'] : false ); }