require_once __DIR__ . '/Maintenance.php';
use Wikimedia\Rdbms\IMaintainableDatabase;
+use Wikimedia\Rdbms\DatabaseSqlite;
/**
* Maintenance script to run database schema updates.
$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' ) ) {
$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" );
];
}
+ /**
+ * @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
);
}