2004-10-13 07:38:43 +00:00
|
|
|
<?php
|
2005-11-01 19:23:18 +00:00
|
|
|
require_once 'counter.php';
|
2004-10-13 07:38:43 +00:00
|
|
|
/**
|
|
|
|
|
* Run all updaters.
|
|
|
|
|
*
|
|
|
|
|
* @todo document
|
2007-01-20 15:09:52 +00:00
|
|
|
* @addtogroup Maintenance
|
2005-08-02 13:35:19 +00:00
|
|
|
*/
|
2004-10-13 07:38:43 +00:00
|
|
|
|
|
|
|
|
/** */
|
2005-08-20 01:57:32 +00:00
|
|
|
$wgUseMasterForMaintenance = true;
|
2006-12-23 13:55:24 +00:00
|
|
|
$options = array( 'quick', 'nopurge' );
|
2004-10-13 07:38:43 +00:00
|
|
|
require_once( "commandLine.inc" );
|
|
|
|
|
require_once( "updaters.inc" );
|
|
|
|
|
$wgTitle = Title::newFromText( "MediaWiki database updater" );
|
2006-04-26 20:42:15 +00:00
|
|
|
$dbclass = 'Database' . ucfirst( $wgDBtype ) ;
|
|
|
|
|
|
|
|
|
|
echo( "MediaWiki {$wgVersion} Updater\n\n" );
|
|
|
|
|
|
2006-11-11 16:59:32 +00:00
|
|
|
install_version_checks();
|
|
|
|
|
|
2006-04-26 20:42:15 +00:00
|
|
|
# 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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# Attempt to connect to the database as a privileged user
|
|
|
|
|
# This will vomit up an error if there are permissions problems
|
2006-10-04 09:06:18 +00:00
|
|
|
$wgDatabase = new $dbclass( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1 );
|
2006-04-26 20:42:15 +00:00
|
|
|
|
|
|
|
|
if( !$wgDatabase->isOpen() ) {
|
|
|
|
|
# Appears to have failed
|
|
|
|
|
echo( "A connection to the database could not be established. Check the\n" );
|
2006-07-17 21:36:19 +00:00
|
|
|
echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" );
|
2006-04-26 20:42:15 +00:00
|
|
|
exit();
|
|
|
|
|
}
|
2004-10-13 07:38:43 +00:00
|
|
|
|
2006-10-04 09:06:18 +00:00
|
|
|
print "Going to run database updates for ".wfWikiID()."\n";
|
2004-12-10 06:05:30 +00:00
|
|
|
print "Depending on the size of your database this may take a while!\n";
|
|
|
|
|
|
2005-04-25 12:03:57 +00:00
|
|
|
if( !isset( $options['quick'] ) ) {
|
2005-06-22 10:11:08 +00:00
|
|
|
print "Abort with control-c in the next five seconds... ";
|
2005-08-02 13:35:19 +00:00
|
|
|
|
2005-11-01 19:23:18 +00:00
|
|
|
for ($i = 6; $i >= 1;) {
|
|
|
|
|
print_c($i, --$i);
|
2005-04-25 12:03:57 +00:00
|
|
|
sleep(1);
|
|
|
|
|
}
|
2005-12-01 07:57:33 +00:00
|
|
|
echo "\n";
|
2005-03-09 15:12:19 +00:00
|
|
|
}
|
2004-12-10 06:05:30 +00:00
|
|
|
|
2006-12-23 13:55:24 +00:00
|
|
|
$shared = isset( $options['doshared'] );
|
|
|
|
|
$purge = !isset( $options['nopurge'] );
|
2006-01-17 11:48:18 +00:00
|
|
|
|
2006-12-23 13:55:24 +00:00
|
|
|
do_all_updates( $shared, $purge );
|
2004-10-13 07:38:43 +00:00
|
|
|
|
|
|
|
|
print "Done.\n";
|
|
|
|
|
|
2007-06-29 01:19:14 +00:00
|
|
|
|