Move cache purging out of doUpdates()
It makes a whole lot more sense to run this at the end of the update process after post update maintenance rather than just at the end of schema updates. Run update.php more than once so all the updatelog entries are populated and you'll see why it makes sense. Change-Id: Ice42a31dee1e6b41da4aa0a47e8786579382aff1
This commit is contained in:
parent
31625b54a0
commit
ee01bb0d94
3 changed files with 13 additions and 15 deletions
|
|
@ -269,14 +269,15 @@ abstract class DatabaseInstaller {
|
|||
|
||||
$ret = true;
|
||||
ob_start( array( $this, 'outputHandler' ) );
|
||||
$up = DatabaseUpdater::newForDB( $this->db );
|
||||
try {
|
||||
$up = DatabaseUpdater::newForDB( $this->db );
|
||||
$up->doUpdates();
|
||||
} catch ( MWException $e ) {
|
||||
echo "\nAn error occurred:\n";
|
||||
echo $e->getText();
|
||||
$ret = false;
|
||||
}
|
||||
$up->purgeCache();
|
||||
ob_end_flush();
|
||||
return $ret;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,8 +292,8 @@ abstract class DatabaseUpdater {
|
|||
*
|
||||
* @param $what Array: what updates to perform
|
||||
*/
|
||||
public function doUpdates( $what = array( 'core', 'extensions', 'purge', 'stats' ) ) {
|
||||
global $wgLocalisationCacheConf, $wgVersion;
|
||||
public function doUpdates( $what = array( 'core', 'extensions', 'stats' ) ) {
|
||||
global $wgVersion;
|
||||
|
||||
$this->db->begin( __METHOD__ );
|
||||
$what = array_flip( $what );
|
||||
|
|
@ -310,14 +310,6 @@ abstract class DatabaseUpdater {
|
|||
if ( isset( $what['stats'] ) ) {
|
||||
$this->checkStats();
|
||||
}
|
||||
|
||||
if ( isset( $what['purge'] ) ) {
|
||||
$this->purgeCache();
|
||||
|
||||
if ( $wgLocalisationCacheConf['manualRecache'] ) {
|
||||
$this->rebuildLocalisationCache();
|
||||
}
|
||||
}
|
||||
$this->db->commit( __METHOD__ );
|
||||
}
|
||||
|
||||
|
|
@ -617,11 +609,15 @@ abstract class DatabaseUpdater {
|
|||
/**
|
||||
* Purge the objectcache table
|
||||
*/
|
||||
protected function purgeCache() {
|
||||
public function purgeCache() {
|
||||
global $wgLocalisationCacheConf;
|
||||
# We can't guarantee that the user will be able to use TRUNCATE,
|
||||
# but we know that DELETE is available to us
|
||||
$this->output( "Purging caches..." );
|
||||
$this->db->delete( 'objectcache', '*', __METHOD__ );
|
||||
if ( $wgLocalisationCacheConf['manualRecache'] ) {
|
||||
$this->rebuildLocalisationCache();
|
||||
}
|
||||
$this->output( "done.\n" );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -118,9 +118,6 @@ class UpdateMediaWiki extends Maintenance {
|
|||
$shared = $this->hasOption( 'doshared' );
|
||||
|
||||
$updates = array( 'core', 'extensions', 'stats' );
|
||||
if( !$this->hasOption('nopurge') ) {
|
||||
$updates[] = 'purge';
|
||||
}
|
||||
|
||||
$updater = DatabaseUpdater::newForDb( $db, $shared, $this );
|
||||
$updater->doUpdates( $updates );
|
||||
|
|
@ -140,6 +137,10 @@ class UpdateMediaWiki extends Maintenance {
|
|||
}
|
||||
}
|
||||
|
||||
if( !$this->hasOption('nopurge') ) {
|
||||
$updater->purgeCache();
|
||||
}
|
||||
|
||||
$this->output( "\nDone.\n" );
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue