(bug 8016) Purge objectcache table during upgrade processes - use the --nopurge optio...
authorRob Church <robchurch@users.mediawiki.org>
Sat, 23 Dec 2006 13:55:24 +0000 (13:55 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Sat, 23 Dec 2006 13:55:24 +0000 (13:55 +0000)
RELEASE-NOTES
maintenance/update.php
maintenance/updaters.inc

index bd41f84..6a5099a 100644 (file)
@@ -393,6 +393,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   revisions
 * (bug 8214) Output file size limit and actual file size in appropriate units
   on Special:Upload
+* (bug 8016) Purge objectcache table during upgrade processes - use the --nopurge
+  option to prevent this when running maintennace/update.php
 
 == Languages updated ==
 
index 402818c..490c3f6 100644 (file)
@@ -10,7 +10,7 @@ require_once 'counter.php';
 
 /** */
 $wgUseMasterForMaintenance = true;
-$options = array( 'quick' );
+$options = array( 'quick', 'nopurge' );
 require_once( "commandLine.inc" );
 require_once( "updaters.inc" );
 $wgTitle = Title::newFromText( "MediaWiki database updater" );
@@ -54,13 +54,10 @@ if( !isset( $options['quick'] ) ) {
        echo "\n";
 }
 
-if ( isset( $options['doshared'] ) ) {
-       $doShared = true;
-} else {
-       $doShared = false;
-}
+$shared = isset( $options['doshared'] );
+$purge = !isset( $options['nopurge'] );
 
-do_all_updates( $doShared );
+do_all_updates( $shared, $purge );
 
 print "Done.\n";
 
index 84eda27..a042cec 100644 (file)
@@ -823,7 +823,16 @@ function do_backlinking_indices_update() {
        }
 }
 
-function do_all_updates( $doShared = false ) {
+function purge_cache() {
+       global $wgDatabase;
+       # We can't guarantee that the user will be able to use TRUNCATE,
+       # but we know that DELETE is available to us
+       echo( "Purging caches..." );
+       $wgDatabase->delete( 'objectcache', '*', __METHOD__ );
+       echo( "done.\n" );
+}
+
+function do_all_updates( $shared = false, $purge = true ) {
        global $wgNewTables, $wgNewFields, $wgRenamedTables, $wgSharedDB, $wgDatabase, $wgDBtype;
 
        $doUser = !$wgSharedDB || $doShared;
@@ -892,6 +901,11 @@ function do_all_updates( $doShared = false ) {
        do_backlinking_indices_update(); flush();
 
        initialiseMessages(); flush();
+       
+       if( $purge ) {
+               purge_cache();
+               flush();
+       }
 }
 
 function archive($name) {