Added $purgeBlobs flag to LocalisationCacheRecache hook
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 28 Dec 2013 08:58:41 +0000 (00:58 -0800)
committerReedy <reedy@wikimedia.org>
Mon, 30 Dec 2013 21:45:59 +0000 (21:45 +0000)
* This helps replace the WMF live hack to skip calling clear()

Change-Id: I37bd6cf87e72b6d32e4c6c261abe2a0ef43d067e

docs/hooks.txt
includes/cache/LocalisationCache.php

index ebc412b..fc4d40e 100644 (file)
@@ -1546,6 +1546,7 @@ cache.
 $cache: The LocalisationCache object
 $code: language code
 &$alldata: The localisation data from core and extensions
+&purgeBlobs: whether to purge/update the message blobs via MessageBlobStore::clear()
 
 'LocalisationChecksBlacklist': When fetching the blacklist of
 localisation checks.
index 55c4c58..47a5904 100644 (file)
@@ -923,7 +923,8 @@ class LocalisationCache {
                        $allData['list'][$key] = array_keys( $allData[$key] );
                }
                # Run hooks
-               wfRunHooks( 'LocalisationCacheRecache', array( $this, $code, &$allData ) );
+               $purgeBlobs = true;
+               wfRunHooks( 'LocalisationCacheRecache', array( $this, $code, &$allData, &$purgeBlobs ) );
 
                if ( is_null( $allData['namespaceNames'] ) ) {
                        wfProfileOut( __METHOD__ );
@@ -958,7 +959,7 @@ class LocalisationCache {
                # Clear out the MessageBlobStore
                # HACK: If using a null (i.e. disabled) storage backend, we
                # can't write to the MessageBlobStore either
-               if ( !$this->store instanceof LCStoreNull ) {
+               if ( $purgeBlobs && !$this->store instanceof LCStoreNull ) {
                        MessageBlobStore::clear();
                }