00001 <?php 00002 require_once 'counter.php'; 00014 $wgUseMasterForMaintenance = true; 00015 $options = array( 'quick', 'nopurge' ); 00016 require_once( "commandLine.inc" ); 00017 require_once( "updaters.inc" ); 00018 $wgTitle = Title::newFromText( "MediaWiki database updater" ); 00019 $dbclass = 'Database' . ucfirst( $wgDBtype ) ; 00020 00021 echo( "MediaWiki {$wgVersion} Updater\n\n" ); 00022 00023 install_version_checks(); 00024 00025 # Do a pre-emptive check to ensure we've got credentials supplied 00026 # We can't, at this stage, check them, but we can detect their absence, 00027 # which seems to cause most of the problems people whinge about 00028 if( !isset( $wgDBadminuser ) || !isset( $wgDBadminpassword ) ) { 00029 echo( "No superuser credentials could be found. Please provide the details\n" ); 00030 echo( "of a user with appropriate permissions to update the database. See\n" ); 00031 echo( "AdminSettings.sample for more details.\n\n" ); 00032 exit(); 00033 } 00034 00035 # Attempt to connect to the database as a privileged user 00036 # This will vomit up an error if there are permissions problems 00037 $wgDatabase = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1 ); 00038 00039 if( !$wgDatabase->isOpen() ) { 00040 # Appears to have failed 00041 echo( "A connection to the database could not be established. Check the\n" ); 00042 echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" ); 00043 exit(); 00044 } 00045 00046 print "Going to run database updates for ".wfWikiID()."\n"; 00047 print "Depending on the size of your database this may take a while!\n"; 00048 00049 if( !isset( $options['quick'] ) ) { 00050 print "Abort with control-c in the next five seconds... "; 00051 00052 for ($i = 6; $i >= 1;) { 00053 print_c($i, --$i); 00054 sleep(1); 00055 } 00056 echo "\n"; 00057 } 00058 00059 $shared = isset( $options['doshared'] ); 00060 $purge = !isset( $options['nopurge'] ); 00061 00062 do_all_updates( $shared, $purge ); 00063 00064 print "Done.\n"; 00065 00066