r75474 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75473‎ | r75474 | r75475 >
Date:21:42, 26 October 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
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
Modified paths:
  • /trunk/phase3/maintenance/update.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/update.php
@@ -9,12 +9,18 @@
1010 * @ingroup Maintenance
1111 */
1212
 13+if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.1.0' ) < 0 ) ) {
 14+ echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP 5.1.0 or higher. ABORTING.\n" .
 15+ "Check if you have a newer php executable with a different name, such as php5.\n";
 16+ die( 1 );
 17+}
 18+
1319 $wgUseMasterForMaintenance = true;
1420 require_once( dirname( __FILE__ ) . '/Maintenance.php' );
1521
1622 class UpdateMediaWiki extends Maintenance {
1723
18 - public function __construct() {
 24+ function __construct() {
1925 parent::__construct();
2026 $this->mDescription = "MediaWiki database updater";
2127 $this->addOption( 'skip-compat-checks', 'Skips compatibility checks, mostly for developers' );
@@ -23,11 +29,11 @@
2430 $this->addOption( 'nopurge', 'Do not purge the objectcache table after updates' );
2531 }
2632
27 - public function getDbType() {
28 - return Maintenance::DB_ADMIN;
 33+ function getDbType() {
 34+ return DB_ADMIN;
2935 }
3036
31 - public function execute() {
 37+ function execute() {
3238 global $wgVersion, $wgTitle, $wgLang;
3339
3440 $wgLang = Language::factory( 'en' );
@@ -61,13 +67,14 @@
6268 $updater->doUpdates( $purge );
6369
6470 foreach( $updater->getPostDatabaseUpdateMaintenance() as $maint ) {
65 - $this->runChild( $maint )->execute();
 71+ $child = $this->runChild( $maint );
 72+ $child->execute();
6673 }
6774
6875 $this->output( "\nDone.\n" );
6976 }
7077
71 - protected function afterFinalSetup() {
 78+ function afterFinalSetup() {
7279 global $wgLocalisationCacheConf;
7380
7481 # Don't try to access the database

Follow-up revisions

RevisionCommit summaryAuthorDate
r75540Follow up r75474platonides13:56, 27 October 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r72539* do_all_updates() is dead...demon14:33, 7 September 2010

Comments

#Comment by Catrope (talk | contribs)   12:14, 27 October 2010
-	public function getDbType() {
-		return Maintenance::DB_ADMIN;
+	function getDbType() {
+		return DB_ADMIN;
 	}
catrope@roanLaptop:~/mediawiki/trunk/phase3$ php maintenance/update.php 
PHP Notice:  Use of undefined constant DB_ADMIN - assumed 'DB_ADMIN' in /home/catrope/mediawiki/trunk/phase3/maintenance/update.php on line 33
#Comment by Platonides (talk | contribs)   13:58, 27 October 2010

Oops. I temporarily changed it and then forgot. Fixed in r75540.

Status & tagging log