function deploy($defs) { // first sort out the historical record... write_array_to_file(self::HISTORYVARIABLENAME, $this->_viewdefs, $this->historyPathname, 'w', ''); $this->_history->append($this->historyPathname); $this->_viewdefs = $defs; require_once 'include/SubPanel/SubPanel.php'; $subpanel = new SubPanel($this->_moduleName, 'fab4', $this->_subpanelName, $this->_aSubPanelObject); $subpanel->saveSubPanelDefOverride($this->_aSubPanelObject, 'list_fields', $defs); // now clear the cache so that the results are immediately visible MetaDataFiles::clearModuleClientCache($this->_aSubPanelObject->template_instance->module_name, 'view'); MetaDataFiles::clearModuleClientCache($this->_moduleName, 'layout'); include_once 'include/TemplateHandler/TemplateHandler.php'; TemplateHandler::clearCache($this->_moduleName); }
/** * Invalidate the cache for a given context/platform without rebuilding. Useful when multiple caches change and we * don't have the resources to rebuild them all within this call. * * TODO: Its usage should be replaced by a queue mechanism to rebuild the caches outside of the request scope. * * @param array $platforms * @param MetaDataContextInterface $contexts */ public function invalidateCache($platforms = array(), MetaDataContextInterface $context = null) { if (!$context) { $context = $this->getDefaultContext(); } if (empty($platforms)) { $platforms = $this->getPlatformsWithCaches(); } $deleted = $this->deletePlatformVisibilityCaches($context); if ($deleted) { foreach ($platforms as $platform) { MetaDataFiles::clearModuleClientCache(array(), '', array($platform)); } } }
/** * Cleans out current metadata cache and rebuilds it for * each platform and visibility */ public function repairMetadataAPICache($section = '') { // Refresh metadata for selected modules only if there selected modules if (is_array($this->module_list) && !empty($this->module_list) && !in_array(translate('LBL_ALL_MODULES'), $this->module_list)) { MetaDataFiles::clearModuleClientCache($this->module_list); MetaDataManager::refreshModulesCache($this->module_list); } // If there is a section named (like 'fields') refresh that section if (!empty($section)) { MetaDataManager::refreshSectionCache($section); } else { // Otherwise if the section is not a false nuke all caches and rebuild // the base metadata cache if ($section !== false) { MetaDataManager::clearAPICache(true, true); MetaDataManager::setupMetadata(); } } }
/** * Clears mobile and portal metadata caches that have been created by the API * to allow immediate rendering of changes at the client */ protected function _clearCaches() { if ($this->implementation->isDeployed()) { MetaDataFiles::clearModuleClientCache($this->_moduleName, 'view'); // Clear out the cache just for the platform we are on $client = empty($this->client) ? 'base' : $this->client; MetaDataManager::refreshModulesCache(array($this->_moduleName), array($client), $this->implementation->getParams()); parent::_clearCaches(); } }
/** * Resets user specific metadata to default */ public function resetToDefault() { if (count($this->params) > 0) { $fileName = $this->getFileNameNoDefault($this->_view, $this->_moduleName); if (file_exists($fileName)) { $this->saveHistory(); SugarAutoLoader::unlink($fileName, true); MetaDataFiles::clearModuleClientCache($this->_moduleName, 'view'); // Clear out the cache just for the platform we are on $client = empty($this->client) ? 'base' : $this->client; MetaDataManager::refreshModulesCache(array($this->_moduleName), array($client), $this->params); } } }