Keep maintenance/update.php php4 compatible up to the point where we can give a maeni...
authorPlatonides <platonides@users.mediawiki.org>
Tue, 26 Oct 2010 21:42:49 +0000 (21:42 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Tue, 26 Oct 2010 21:42:49 +0000 (21:42 +0000)
Follow up conversion to new maintenance format in r72539

maintenance/update.php

index bb3f8d0..84a1d46 100644 (file)
@@ -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