diff options
Diffstat (limited to 'maintenance/update.php')
-rw-r--r-- | maintenance/update.php | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/maintenance/update.php b/maintenance/update.php index 19429716..046d73cd 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -1,3 +1,4 @@ +#!/usr/bin/env php <?php /** * Run all updaters. @@ -25,7 +26,7 @@ * @ingroup Maintenance */ -if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.3.2' ) < 0 ) ) { +if ( !function_exists( 'version_compare' ) || ( version_compare( PHP_VERSION, '5.3.2' ) < 0 ) ) { require dirname( __FILE__ ) . '/../includes/PHPVersionError.php'; wfPHPVersionError( 'cli' ); } @@ -47,13 +48,19 @@ class UpdateMediaWiki extends Maintenance { $this->addOption( 'doshared', 'Also update shared tables' ); $this->addOption( 'nopurge', 'Do not purge the objectcache table after updates' ); $this->addOption( 'noschema', 'Only do the updates that are not done during schema updates' ); - $this->addOption( 'schema', 'Output SQL to do the schema updates instead of doing them. Works even when $wgAllowSchemaUpdates is false', false, true ); + $this->addOption( + 'schema', + 'Output SQL to do the schema updates instead of doing them. Works ' + . 'even when $wgAllowSchemaUpdates is false', + false, + true + ); $this->addOption( 'force', 'Override when $wgAllowSchemaUpdates disables this script' ); } function getDbType() { /* If we used the class constant PHP4 would give a parser error here */ - return 2 /* Maintenance::DB_ADMIN */; + return 2; /* Maintenance::DB_ADMIN */ } function compatChecks() { @@ -74,30 +81,22 @@ class UpdateMediaWiki extends Maintenance { $test = new PhpXmlBugTester(); if ( !$test->ok ) { $this->error( - "Your system has a combination of PHP and libxml2 versions which is buggy\n" . + "Your system has a combination of PHP and libxml2 versions that is buggy\n" . "and can cause hidden data corruption in MediaWiki and other web apps.\n" . - "Upgrade to PHP 5.2.9 or later and libxml2 2.7.3 or later!\n" . - "ABORTING (see http://bugs.php.net/bug.php?id=45996).\n", - true ); - } - - $test = new PhpRefCallBugTester; - $test->execute(); - if ( !$test->ok ) { - $ver = phpversion(); - $this->error( - "PHP $ver is not compatible with MediaWiki due to a bug involving\n" . - "reference parameters to __call. Upgrade to PHP 5.3.2 or higher, or \n" . - "downgrade to PHP 5.3.0 to fix this.\n" . - "ABORTING (see http://bugs.php.net/bug.php?id=50394 for details)\n", + "Upgrade to libxml2 2.7.3 or later.\n" . + "ABORTING (see https://bugs.php.net/bug.php?id=45996).\n", true ); } } function execute() { - global $wgVersion, $wgTitle, $wgLang, $wgAllowSchemaUpdates; + global $wgVersion, $wgLang, $wgAllowSchemaUpdates; - if ( !$wgAllowSchemaUpdates && !( $this->hasOption( 'force' ) || $this->hasOption( 'schema' ) || $this->hasOption( 'noschema' ) ) ) { + if ( !$wgAllowSchemaUpdates + && !( $this->hasOption( 'force' ) + || $this->hasOption( 'schema' ) + || $this->hasOption( 'noschema' ) ) + ) { $this->error( "Do not run update.php on this wiki. If you're seeing this you should\n" . "probably ask for some help in performing your schema updates or use\n" . "the --noschema and --schema options to get an SQL file for someone\n" @@ -118,7 +117,8 @@ class UpdateMediaWiki extends Maintenance { } $wgLang = Language::factory( 'en' ); - $wgTitle = Title::newFromText( "MediaWiki database updater" ); + + define( 'MW_UPDATER', true ); $this->output( "MediaWiki {$wgVersion} Updater\n\n" ); @@ -142,10 +142,13 @@ class UpdateMediaWiki extends Maintenance { $this->output( "Depending on the size of your database this may take a while!\n" ); if ( !$this->hasOption( 'quick' ) ) { - $this->output( "Abort with control-c in the next five seconds (skip this countdown with --quick) ... " ); + $this->output( "Abort with control-c in the next five seconds " + . "(skip this countdown with --quick) ... " ); wfCountDown( 5 ); } + $time1 = new MWTimestamp(); + $shared = $this->hasOption( 'doshared' ); $updates = array( 'core', 'extensions' ); @@ -178,8 +181,10 @@ class UpdateMediaWiki extends Maintenance { if ( !$this->hasOption( 'nopurge' ) ) { $updater->purgeCache(); } + $time2 = new MWTimestamp(); - $this->output( "\nDone.\n" ); + $timeDiff = $time2->diff( $time1 ); + $this->output( "\nDone in " . $timeDiff->format( "%i:%S" ) . ".\n" ); } function afterFinalSetup() { @@ -190,7 +195,7 @@ class UpdateMediaWiki extends Maintenance { # cache from $wgExtensionFunctions (bug 20471) $wgLocalisationCacheConf = array( 'class' => 'LocalisationCache', - 'storeClass' => 'LCStore_Null', + 'storeClass' => 'LCStoreNull', 'storeDirectory' => false, 'manualRecache' => false, ); |