summaryrefslogtreecommitdiff
path: root/maintenance/update.php
diff options
context:
space:
mode:
Diffstat (limited to 'maintenance/update.php')
-rw-r--r--maintenance/update.php56
1 files changed, 25 insertions, 31 deletions
diff --git a/maintenance/update.php b/maintenance/update.php
index 3f484137..5977a4c1 100644
--- a/maintenance/update.php
+++ b/maintenance/update.php
@@ -1,5 +1,4 @@
<?php
-require_once 'counter.php';
/**
* Run all updaters.
*
@@ -11,49 +10,32 @@ require_once 'counter.php';
*/
/** */
+define( 'MW_CMDLINE_CALLBACK', 'wfSetupUpdateScript' );
$wgUseMasterForMaintenance = true;
-$options = array( 'quick', 'nopurge' );
-require_once( "commandLine.inc" );
-require_once( "updaters.inc" );
+require_once( dirname(__FILE__) . '/commandLine.inc' );
+require( "updaters.inc" );
+
$wgTitle = Title::newFromText( "MediaWiki database updater" );
-$dbclass = 'Database' . ucfirst( $wgDBtype ) ;
echo( "MediaWiki {$wgVersion} Updater\n\n" );
-install_version_checks();
-
-# Do a pre-emptive check to ensure we've got credentials supplied
-# We can't, at this stage, check them, but we can detect their absence,
-# which seems to cause most of the problems people whinge about
-if( !isset( $wgDBadminuser ) || !isset( $wgDBadminpassword ) ) {
- echo( "No superuser credentials could be found. Please provide the details\n" );
- echo( "of a user with appropriate permissions to update the database. See\n" );
- echo( "AdminSettings.sample for more details.\n\n" );
- exit();
+if( !isset( $options['skip-compat-checks'] ) ) {
+ install_version_checks();
+} else {
+ print "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
-$wgDatabase = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1 );
-
-if( !$wgDatabase->isOpen() ) {
- # Appears to have failed
- echo( "A connection to the database could not be established. Check the\n" );
- echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" );
- exit();
-}
+$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";
+ print "Abort with control-c in the next five seconds (skip this countdown with --quick) ... ";
+ wfCountDown( 5 );
}
$shared = isset( $options['doshared'] );
@@ -63,4 +45,16 @@ 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,
+ );
+}