// but that's no longer the canonical store. Re-sync from canonical store to ensure
// that we display that latest data. This is inefficient - at some point, we
// should rewrite this UI.
- CRM_Core_BAO_WordReplacement::rebuild();
+ CRM_Core_BAO_WordReplacement::rebuild(FALSE);
$this->_soInstance = CRM_Utils_Array::value('instance', $_GET);
$this->assign('soInstance', $this->_soInstance);
/**
* Rebuild
*/
- static function rebuild() {
+ static function rebuild($clearCaches = TRUE) {
$id = CRM_Core_Config::domainID();
$stringOverride = self::getAllAsConfigArray($id);
$params = array('locale_custom_strings' => serialize($stringOverride));
if ($wordReplacementSettings) {
CRM_Core_Config::singleton()->localeCustomStrings = $stringOverride;
- // Reset navigation
- CRM_Core_BAO_Navigation::resetNavigation();
- // Clear js string cache
- CRM_Core_Resources::singleton()->flushStrings();
- // Clear dynamic js files which may contain localization
- CRM_Utils_File::flushDynamicResources();
+ // Partially mitigate the inefficiency introduced in CRM-13187 by doing this conditionally
+ if ($clearCaches) {
+ // Reset navigation
+ CRM_Core_BAO_Navigation::resetNavigation();
+ // Clear js localization
+ CRM_Core_Resources::singleton()->flushStrings()->rebuildDynamicResources();
+ }
return TRUE;
}
// also cleanup module permissions
$config->cleanupPermissions();
- // also rebuild word replacement cache
- CRM_Core_BAO_WordReplacement::rebuild();
-
- // Clear dynamic js files
- CRM_Utils_File::flushDynamicResources();
+ // rebuild word replacement cache - pass false to prevent operations redundant with this fn
+ CRM_Core_BAO_WordReplacement::rebuild(FALSE);
CRM_Core_BAO_Setting::updateSettingsFromMetaData();
- CRM_Core_Resources::singleton()->resetCacheCode();
+ // Clear js caches
+ CRM_Core_Resources::singleton()->flushStrings()->rebuildDynamicResources();
CRM_Case_XMLRepository::singleton(TRUE);
// also rebuild triggers if requested explicitly
if ($this->cacheCodeKey) {
CRM_Core_BAO_Setting::setItem($value, CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME, $this->cacheCodeKey);
}
+ return $this;
}
public function resetCacheCode() {
$this->setCacheCode(CRM_Utils_String::createRandom(5, CRM_Utils_String::ALPHANUMERIC));
// Also flush cms resource cache if needed
CRM_Core_Config::singleton()->userSystem->clearResourceCache();
+ return $this;
}
/**
*/
public function flushStrings() {
$this->cache->flush();
+ return $this;
+ }
+
+ /**
+ * Deletes and rebuilds dynamic resource files
+ */
+ public function rebuildDynamicResources() {
+ CRM_Utils_File::flushDynamicResources();
+ $this->addLocalizationJs();
+ return $this;
}
/**