/**
* Run all updaters.
*
+ * This is used when the database schema is modified and we need to apply patches.
+ *
+ * @file
* @todo document
- * @package MediaWiki
- * @subpackage Maintenance
- */
+ * @ingroup Maintenance
+ */
/** */
-$options = array( 'quick' );
-require_once( "commandLine.inc" );
-require_once( "updaters.inc" );
+define( 'MW_CMDLINE_CALLBACK', 'wfSetupUpdateScript' );
+$wgUseMasterForMaintenance = true;
+require_once( dirname(__FILE__) . '/commandLine.inc' );
+require( "updaters.inc" );
+
$wgTitle = Title::newFromText( "MediaWiki database updater" );
-$wgDatabase = Database::newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname );
-print "Going to run database updates for $wgDBname\n";
+echo( "MediaWiki {$wgVersion} Updater\n\n" );
+
+install_version_checks();
+
+# Attempt to connect to the database as a privileged user
+# This will vomit up an error if there are permissions problems
+$wgDatabase = wfGetDB( DB_MASTER );
+
+print "Going to run database updates for ".wfWikiID()."\n";
print "Depending on the size of your database this may take a while!\n";
if( !isset( $options['quick'] ) ) {
- print "Abort with control-c in the next five seconds to aboard.. ";
-
- for ($i = 5; $i >= 0; --$i) {
- echo $i;
- sleep(1);
- echo( ($i == 0) ? "\n" : chr(8) );
- }
+ print "Abort with control-c in the next five seconds... ";
+ wfCountDown( 5 );
}
-do_all_updates();
+$shared = isset( $options['doshared'] );
+$purge = !isset( $options['nopurge'] );
+
+do_all_updates( $shared, $purge );
print "Done.\n";
-?>
+function wfSetupUpdateScript() {
+ global $wgLocalisationCacheConf;
+
+ # Don't try to access the database
+ # This needs to be disabled early since extensions will try to use the l10n
+ # cache from $wgExtensionSetupFunctions (bug 20471)
+ $wgLocalisationCacheConf = array(
+ 'class' => 'LocalisationCache',
+ 'storeClass' => 'LCStore_Null',
+ 'storeDirectory' => false,
+ 'manualRecache' => false,
+ );
+}