From 30d21e6d66df92d310ae7d4f86c4ab358ebf4b4c Mon Sep 17 00:00:00 2001 From: Platonides Date: Tue, 26 Oct 2010 21:42:49 +0000 Subject: [PATCH] Keep maintenance/update.php php4 compatible up to the point where we can give a maeningful error. Check based in install_version_checks() Follow up conversion to new maintenance format in r72539 --- maintenance/update.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/maintenance/update.php b/maintenance/update.php index bb3f8d0fe7..84a1d46242 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -9,12 +9,18 @@ * @ingroup Maintenance */ +if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.1.0' ) < 0 ) ) { + echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP 5.1.0 or higher. ABORTING.\n" . + "Check if you have a newer php executable with a different name, such as php5.\n"; + die( 1 ); +} + $wgUseMasterForMaintenance = true; require_once( dirname( __FILE__ ) . '/Maintenance.php' ); class UpdateMediaWiki extends Maintenance { - public function __construct() { + function __construct() { parent::__construct(); $this->mDescription = "MediaWiki database updater"; $this->addOption( 'skip-compat-checks', 'Skips compatibility checks, mostly for developers' ); @@ -23,11 +29,11 @@ class UpdateMediaWiki extends Maintenance { $this->addOption( 'nopurge', 'Do not purge the objectcache table after updates' ); } - public function getDbType() { - return Maintenance::DB_ADMIN; + function getDbType() { + return DB_ADMIN; } - public function execute() { + function execute() { global $wgVersion, $wgTitle, $wgLang; $wgLang = Language::factory( 'en' ); @@ -61,13 +67,14 @@ class UpdateMediaWiki extends Maintenance { $updater->doUpdates( $purge ); foreach( $updater->getPostDatabaseUpdateMaintenance() as $maint ) { - $this->runChild( $maint )->execute(); + $child = $this->runChild( $maint ); + $child->execute(); } $this->output( "\nDone.\n" ); } - protected function afterFinalSetup() { + function afterFinalSetup() { global $wgLocalisationCacheConf; # Don't try to access the database -- 2.20.1