Restructured the languages directory, to avoid problems when people untar MW 1.8...
[lhc/web/wiklou.git] / maintenance / update.php
1 <?php
2 require_once 'counter.php';
3 /**
4 * Run all updaters.
5 *
6 * @todo document
7 * @package MediaWiki
8 * @subpackage Maintenance
9 */
10
11 /** */
12 $wgUseMasterForMaintenance = true;
13 $options = array( 'quick' );
14 require_once( "commandLine.inc" );
15 require_once( "updaters.inc" );
16 $wgTitle = Title::newFromText( "MediaWiki database updater" );
17 $dbclass = 'Database' . ucfirst( $wgDBtype ) ;
18 $dbc = new $dbclass;
19
20 echo( "MediaWiki {$wgVersion} Updater\n\n" );
21
22 # Do a pre-emptive check to ensure we've got credentials supplied
23 # We can't, at this stage, check them, but we can detect their absence,
24 # which seems to cause most of the problems people whinge about
25 if( !isset( $wgDBadminuser ) || !isset( $wgDBadminpassword ) ) {
26 echo( "No superuser credentials could be found. Please provide the details\n" );
27 echo( "of a user with appropriate permissions to update the database. See\n" );
28 echo( "AdminSettings.sample for more details.\n\n" );
29 exit();
30 }
31
32 # Attempt to connect to the database as a privileged user
33 # This will vomit up an error if there are permissions problems
34 $wgDatabase = $dbc->newFromParams( $wgDBserver, $wgDBadminuser, $wgDBadminpassword, $wgDBname, 1 );
35
36 if( !$wgDatabase->isOpen() ) {
37 # Appears to have failed
38 echo( "A connection to the database could not be established. Check the\n" );
39 echo( "values of \$wgDBadminuser and \$wgDBadminpassword.\n" );
40 exit();
41 }
42
43 print "Going to run database updates for $wgDBname\n";
44 print "Depending on the size of your database this may take a while!\n";
45
46 if( !isset( $options['quick'] ) ) {
47 print "Abort with control-c in the next five seconds... ";
48
49 for ($i = 6; $i >= 1;) {
50 print_c($i, --$i);
51 sleep(1);
52 }
53 echo "\n";
54 }
55
56 if ( isset( $options['doshared'] ) ) {
57 $doShared = true;
58 } else {
59 $doShared = false;
60 }
61
62 do_all_updates( $doShared );
63
64 print "Done.\n";
65
66 ?>