<?php
-require_once 'counter.php';
/**
* 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
*/
/** */
$wgUseMasterForMaintenance = true;
-$options = array( 'quick' );
-require_once( "commandLine.inc" );
-require_once( "updaters.inc" );
+require_once( dirname(__FILE__) . '/commandLine.inc' );
+require( "updaters.inc" );
+
+# Don't try to load stuff from l10n_cache yet
+$lc = Language::getLocalisationCache();
+$lc->disableBackend();
+
$wgTitle = Title::newFromText( "MediaWiki database updater" );
-$dbclass = 'Database'.ucfirst($wgDBtype);
-require_once("$dbclass.php");
-$dbc = new $dbclass;
-# TODO : check for AdminSettings file existence ? See #5725
-print "Attempting connection to the database. If it fails, maybe you are\n";
-print "missing a proper AdminSettings.php file in $IP\n\n";
-$wgDatabase = $dbc->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... ";
-
- for ($i = 6; $i >= 1;) {
- print_c($i, --$i);
- sleep(1);
- }
- echo "\n";
+ wfCountDown( 5 );
}
-if ( isset( $options['doshared'] ) ) {
- $doShared = true;
-} else {
- $doShared = false;
-}
+$shared = isset( $options['doshared'] );
+$purge = !isset( $options['nopurge'] );
-do_all_updates( $doShared );
+do_all_updates( $shared, $purge );
print "Done.\n";
-?>
+