2004-10-13 07:38:43 +00:00
|
|
|
<?php
|
|
|
|
|
/**
|
|
|
|
|
* Run all updaters.
|
|
|
|
|
*
|
2008-07-19 12:15:07 +00:00
|
|
|
* This is used when the database schema is modified and we need to apply patches.
|
|
|
|
|
*
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @file
|
2004-10-13 07:38:43 +00:00
|
|
|
* @todo document
|
WARNING: HUGE COMMIT
Doxygen documentation update:
* Changed alls @addtogroup to @ingroup. @addtogroup adds the comment to the group description, but doesn't add the file, class, function, ... to the group like @ingroup does. See for example http://svn.wikimedia.org/doc/group__SpecialPage.html where it's impossible to see related files, classes, ... that should belong to that group.
* Added @file to file description, it seems that it should be explicitely decalred for file descriptions, otherwise doxygen will think that the comment document the first class, variabled, function, ... that is in that file.
* Removed some empty comments
* Removed some ?>
Added following groups:
* ExternalStorage
* JobQueue
* MaintenanceLanguage
One more thing: there are still a lot of warnings when generating the doc.
2008-05-20 17:13:28 +00:00
|
|
|
* @ingroup Maintenance
|
2005-08-02 13:35:19 +00:00
|
|
|
*/
|
2004-10-13 07:38:43 +00:00
|
|
|
|
2005-08-20 01:57:32 +00:00
|
|
|
$wgUseMasterForMaintenance = true;
|
2010-10-10 08:35:07 +00:00
|
|
|
require_once( dirname( __FILE__ ) . '/Maintenance.php' );
|
2009-07-03 06:56:46 +00:00
|
|
|
|
2010-09-07 14:33:11 +00:00
|
|
|
class UpdateMediaWiki extends Maintenance {
|
2006-04-26 20:42:15 +00:00
|
|
|
|
2010-09-07 14:33:11 +00:00
|
|
|
public function __construct() {
|
|
|
|
|
parent::__construct();
|
|
|
|
|
$this->mDescription = "MediaWiki database updater";
|
|
|
|
|
$this->addOption( 'skip-compat-checks', 'Skips compatibility checks, mostly for developers' );
|
|
|
|
|
$this->addOption( 'quick', 'Skip 5 second countdown before starting' );
|
|
|
|
|
$this->addOption( 'doshared', 'Also update shared tables' );
|
|
|
|
|
$this->addOption( 'nopurge', 'Do not purge the objectcache table after updates' );
|
|
|
|
|
}
|
2006-04-26 20:42:15 +00:00
|
|
|
|
2010-09-07 14:33:11 +00:00
|
|
|
public function getDbType() {
|
2010-09-11 20:43:45 +00:00
|
|
|
return Maintenance::DB_ADMIN;
|
2010-09-07 14:33:11 +00:00
|
|
|
}
|
2006-11-11 16:59:32 +00:00
|
|
|
|
2010-09-07 14:33:11 +00:00
|
|
|
public function execute() {
|
2010-09-13 17:01:04 +00:00
|
|
|
global $wgVersion, $wgTitle, $wgLang;
|
2004-10-13 07:38:43 +00:00
|
|
|
|
2010-09-13 17:01:04 +00:00
|
|
|
$wgLang = Language::factory( 'en' );
|
2010-09-07 14:33:11 +00:00
|
|
|
$wgTitle = Title::newFromText( "MediaWiki database updater" );
|
2004-12-10 06:05:30 +00:00
|
|
|
|
2010-09-07 14:33:11 +00:00
|
|
|
$this->output( "MediaWiki {$wgVersion} Updater\n\n" );
|
|
|
|
|
|
2010-09-11 21:56:11 +00:00
|
|
|
if ( !$this->hasOption( 'skip-compat-checks' ) ) {
|
2010-09-07 14:33:11 +00:00
|
|
|
install_version_checks();
|
|
|
|
|
} else {
|
|
|
|
|
$this->output( "Skipping compatibility checks, proceed at your own risk (Ctrl+C to abort)\n" );
|
|
|
|
|
wfCountdown( 5 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Attempt to connect to the database as a privileged user
|
|
|
|
|
# This will vomit up an error if there are permissions problems
|
|
|
|
|
$db = wfGetDB( DB_MASTER );
|
|
|
|
|
|
|
|
|
|
$this->output( "Going to run database updates for " . wfWikiID() . "\n" );
|
|
|
|
|
$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) ... " );
|
|
|
|
|
wfCountDown( 5 );
|
|
|
|
|
}
|
2004-12-10 06:05:30 +00:00
|
|
|
|
2010-09-07 14:33:11 +00:00
|
|
|
$shared = $this->hasOption( 'doshared' );
|
|
|
|
|
$purge = !$this->hasOption( 'nopurge' );
|
2006-01-17 11:48:18 +00:00
|
|
|
|
2010-09-07 14:33:11 +00:00
|
|
|
$updater = DatabaseUpdater::newForDb( $db, $shared );
|
|
|
|
|
$updater->doUpdates( $purge );
|
2004-10-13 07:38:43 +00:00
|
|
|
|
2010-09-07 14:33:11 +00:00
|
|
|
foreach( $updater->getPostDatabaseUpdateMaintenance() as $maint ) {
|
2010-09-12 09:07:51 +00:00
|
|
|
$this->runChild( $maint )->execute();
|
2010-09-07 14:33:11 +00:00
|
|
|
}
|
|
|
|
|
|
2010-09-12 09:07:51 +00:00
|
|
|
$this->output( "\nDone.\n" );
|
2010-09-07 14:33:11 +00:00
|
|
|
}
|
2004-10-13 07:38:43 +00:00
|
|
|
|
2010-09-07 20:45:04 +00:00
|
|
|
protected function afterFinalSetup() {
|
|
|
|
|
global $wgLocalisationCacheConf;
|
|
|
|
|
|
|
|
|
|
# Don't try to access the database
|
|
|
|
|
# This needs to be disabled early since extensions will try to use the l10n
|
2010-10-02 21:09:23 +00:00
|
|
|
# cache from $wgExtensionFunctions (bug 20471)
|
2010-09-07 20:45:04 +00:00
|
|
|
$wgLocalisationCacheConf = array(
|
|
|
|
|
'class' => 'LocalisationCache',
|
|
|
|
|
'storeClass' => 'LCStore_Null',
|
|
|
|
|
'storeDirectory' => false,
|
|
|
|
|
'manualRecache' => false,
|
|
|
|
|
);
|
|
|
|
|
}
|
2009-09-04 02:03:23 +00:00
|
|
|
}
|
2010-09-07 14:33:11 +00:00
|
|
|
|
|
|
|
|
$maintClass = 'UpdateMediaWiki';
|
|
|
|
|
require_once( DO_MAINTENANCE );
|