Remove unused global $IP
[lhc/web/wiklou.git] / maintenance / update.php
1 <?php
2 /**
3 * Run all updaters.
4 *
5 * This is used when the database schema is modified and we need to apply patches.
6 *
7 * @file
8 * @todo document
9 * @ingroup Maintenance
10 */
11
12 /** */
13 define( 'MW_CMDLINE_CALLBACK', 'wfSetupUpdateScript' );
14 $wgUseMasterForMaintenance = true;
15 require_once( dirname( __FILE__ ) . '/commandLine.inc' );
16 require( "updaters.inc" );
17
18 $wgTitle = Title::newFromText( "MediaWiki database updater" );
19
20 echo( "MediaWiki {$wgVersion} Updater\n\n" );
21
22 if ( !isset( $options['skip-compat-checks'] ) ) {
23 install_version_checks();
24 } else {
25 print "Skipping compatibility checks, proceed at your own risk (Ctrl+C to abort)\n";
26 wfCountdown( 5 );
27 }
28
29 # Attempt to connect to the database as a privileged user
30 # This will vomit up an error if there are permissions problems
31 $wgDatabase = wfGetDB( DB_MASTER );
32
33 print "Going to run database updates for " . wfWikiID() . "\n";
34 print "Depending on the size of your database this may take a while!\n";
35
36 if ( !isset( $options['quick'] ) ) {
37 print "Abort with control-c in the next five seconds (skip this countdown with --quick) ... ";
38 wfCountDown( 5 );
39 }
40
41 $shared = isset( $options['doshared'] );
42 $purge = !isset( $options['nopurge'] );
43
44 do_all_updates( $shared, $purge );
45
46 print "Done.\n";
47
48 function wfSetupUpdateScript() {
49 global $wgLocalisationCacheConf;
50
51 # Don't try to access the database
52 # This needs to be disabled early since extensions will try to use the l10n
53 # cache from $wgExtensionSetupFunctions (bug 20471)
54 $wgLocalisationCacheConf = array(
55 'class' => 'LocalisationCache',
56 'storeClass' => 'LCStore_Null',
57 'storeDirectory' => false,
58 'manualRecache' => false,
59 );
60 }