X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%29%20.%20%22?a=blobdiff_plain;f=maintenance%2Fupdate.php;h=6fcec2c4cb9d7caf3551a99231a17a5f9a1783f1;hb=beb1c4a0eced04ce2098433c383f1fbe469569c9;hp=ba1d8cdc62cddffbe3364440745529d263fb414b;hpb=0a32a34775b8f8042868a14903d3c217cf2c46bc;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/update.php b/maintenance/update.php index ba1d8cdc62..6fcec2c4cb 100644 --- a/maintenance/update.php +++ b/maintenance/update.php @@ -26,13 +26,12 @@ */ if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.3.2' ) < 0 ) ) { - echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP 5.3.2 or higher. ABORTING.\n" . - "Check if you have a newer php executable with a different name, such as php5.\n"; - die( 1 ); + require dirname( __FILE__ ) . '/../includes/PHPVersionError.php'; + wfPHPVersionError( 'cli' ); } $wgUseMasterForMaintenance = true; -require_once( __DIR__ . '/Maintenance.php' ); +require_once __DIR__ . '/Maintenance.php'; /** * Maintenance script to run database schema updates. @@ -84,7 +83,7 @@ class UpdateMediaWiki extends Maintenance { function execute() { global $wgVersion, $wgTitle, $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" @@ -93,12 +92,12 @@ class UpdateMediaWiki extends Maintenance { } $this->fileHandle = null; - if( substr( $this->getOption( 'schema' ), 0, 2 ) === "--" ) { + if ( substr( $this->getOption( 'schema' ), 0, 2 ) === "--" ) { $this->error( "The --schema option requires a file as an argument.\n", true ); - } else if( $this->hasOption( 'schema' ) ) { + } elseif ( $this->hasOption( 'schema' ) ) { $file = $this->getOption( 'schema' ); $this->fileHandle = fopen( $file, "w" ); - if( $this->fileHandle === false ) { + if ( $this->fileHandle === false ) { $err = error_get_last(); $this->error( "Problem opening the schema file for writing: $file\n\t{$err['message']}", true ); } @@ -123,7 +122,7 @@ class UpdateMediaWiki extends Maintenance { $db = wfGetDB( DB_MASTER ); $this->output( "Going to run database updates for " . wfWikiID() . "\n" ); - if( $db->getType() === 'sqlite' ) { + if ( $db->getType() === 'sqlite' ) { $this->output( "Using SQLite file: '{$db->mDatabaseFile}'\n" ); } $this->output( "Depending on the size of your database this may take a while!\n" ); @@ -136,13 +135,13 @@ class UpdateMediaWiki extends Maintenance { $shared = $this->hasOption( 'doshared' ); $updates = array( 'core', 'extensions' ); - if( !$this->hasOption('schema') ) { - if( $this->hasOption('noschema') ) { + if ( !$this->hasOption( 'schema' ) ) { + if ( $this->hasOption( 'noschema' ) ) { $updates[] = 'noschema'; } $updates[] = 'stats'; - if( !$this->hasOption('nopurge') ) { + if ( !$this->hasOption( 'nopurge' ) ) { $updates[] = 'purge'; } } @@ -150,11 +149,11 @@ class UpdateMediaWiki extends Maintenance { $updater = DatabaseUpdater::newForDb( $db, $shared, $this ); $updater->doUpdates( $updates ); - foreach( $updater->getPostDatabaseUpdateMaintenance() as $maint ) { + foreach ( $updater->getPostDatabaseUpdateMaintenance() as $maint ) { $child = $this->runChild( $maint ); // LoggedUpdateMaintenance is checking the updatelog itself - $isLoggedUpdate = ( $child instanceof LoggedUpdateMaintenance ); + $isLoggedUpdate = is_a( $child, 'LoggedUpdateMaintenance' ); if ( !$isLoggedUpdate && $updater->updateRowExists( $maint ) ) { continue; @@ -167,7 +166,7 @@ class UpdateMediaWiki extends Maintenance { } } - if( !$this->hasOption('nopurge') ) { + if ( !$this->hasOption( 'nopurge' ) ) { $updater->purgeCache(); } @@ -190,4 +189,4 @@ class UpdateMediaWiki extends Maintenance { } $maintClass = 'UpdateMediaWiki'; -require_once( RUN_MAINTENANCE_IF_MAIN ); +require_once RUN_MAINTENANCE_IF_MAIN;