Remove unused parameter
[mediawiki.git] / maintenance / update.php
blob3f4841378387d7beae43fe0681a75d57c40f4b84
1 <?php
2 require_once 'counter.php';
3 /**
4 * Run all updaters.
6 * This is used when the database schema is modified and we need to apply patches.
8 * @file
9 * @todo document
10 * @ingroup Maintenance
13 /** */
14 $wgUseMasterForMaintenance = true;
15 $options = array( 'quick', 'nopurge' );
16 require_once( "commandLine.inc" );
17 require_once( "updaters.inc" );
18 $wgTitle = Title::newFromText( "MediaWiki database updater" );
19 $dbclass = 'Database' . ucfirst( $wgDBtype ) ;
21 echo( "MediaWiki {$wgVersion} Updater\n\n" );
23 install_version_checks();
25 # Do a pre-emptive check to ensure we've got credentials supplied
26 # We can't, at this stage, check them, but we can detect their absence,
27 # which seems to cause most of the problems people whinge about
28 if( !isset( $wgDBadminuser ) || !isset( $wgDBadminpassword ) ) {
29 echo( "No superuser credentials could be found. Please provide the details\n" );
30 echo( "of a user with appropriate permissions to update the database. See\n" );
31 echo( "AdminSettings.sample for more details.\n\n" );
32 exit();
35 # Attempt to connect to the database as a privileged user
36 # This will vomit up an error if there are permissions problems
37 $wgDatabase = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1 );
39 if( !$wgDatabase->isOpen() ) {
40 # Appears to have failed
41 echo( "A connection to the database could not be established. Check the\n" );
42 echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" );
43 exit();
46 print "Going to run database updates for ".wfWikiID()."\n";
47 print "Depending on the size of your database this may take a while!\n";
49 if( !isset( $options['quick'] ) ) {
50 print "Abort with control-c in the next five seconds... ";
52 for ($i = 6; $i >= 1;) {
53 print_c($i, --$i);
54 sleep(1);
56 echo "\n";
59 $shared = isset( $options['doshared'] );
60 $purge = !isset( $options['nopurge'] );
62 do_all_updates( $shared, $purge );
64 print "Done.\n";