本文整理汇总了PHP中sugar_cache_clear函数的典型用法代码示例。如果您正苦于以下问题:PHP sugar_cache_clear函数的具体用法?PHP sugar_cache_clear怎么用?PHP sugar_cache_clear使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sugar_cache_clear函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testStoreClearCacheKeyAndRetrieve
public function testStoreClearCacheKeyAndRetrieve()
{
sugar_cache_put($this->_cacheKey1, $this->_cacheValue1);
sugar_cache_put($this->_cacheKey2, $this->_cacheValue2);
sugar_cache_clear($this->_cacheKey1);
$this->assertNotEquals($this->_cacheValue1, sugar_cache_retrieve($this->_cacheKey1));
$this->assertEquals($this->_cacheValue2, sugar_cache_retrieve($this->_cacheKey2));
}
示例2: setUp
public function setUp()
{
if (!is_dir('custom/include/language')) {
@mkdir('custom/include/language', 0777, true);
}
sugar_cache_clear('app_list_strings.en_us');
sugar_cache_clear('app_list_strings.fr_test');
}
示例3: tearDown
public function tearDown()
{
unlink('include/language/fr_test.lang.php');
unlink('include/language/de_test.lang.php');
sugar_cache_clear('app_list_strings.en_us');
sugar_cache_clear('app_list_strings.fr_test');
sugar_cache_clear('app_list_strings.de_test');
if (isset($this->_backup_default_language)) {
$sugar_config['default_language'] = $this->_backup_default_language;
}
}
示例4: clearCaches
public function clearCaches()
{
//Need to invalidate the caches for rolesets when roles change (availible modules may change)
if ($this->load_relationship('acl_role_sets')) {
$rolesets = $this->acl_role_sets->getBeans();
$mm = MetaDataManager::getManager();
foreach ($rolesets as $roleset) {
$context = new MetaDataContextRoleSet($roleset);
$mm->invalidateCache($mm->getPlatformsWithCaches(), $context);
}
}
sugar_cache_clear('ACL');
}
示例5: tearDown
public function tearDown()
{
$_REQUEST = array();
sugar_cache_clear('mod_strings.en_us');
if (file_exists('custom/modules/' . $this->module . '/language/en_us.lang.php')) {
unlink('custom/modules/' . $this->module . '/language/en_us.lang.php');
}
if (file_exists('custom/modules/' . $this->add_module . '/language/en_us.lang.php')) {
unlink('custom/modules/' . $this->add_module . '/language/en_us.lang.php');
}
SugarTestHelper::tearDown();
parent::tearDown();
}
示例6: display
function display()
{
global $mod_strings, $export_module, $current_language, $theme, $current_user;
echo get_module_title("Activities", $mod_strings['LBL_MODULE_TITLE'], true);
$mod_strings = return_module_language($current_language, 'Calls');
// Overload the export module since the user got here by clicking the "Activities" tab
$export_module = "Calls";
$_REQUEST['module'] = 'Calls';
$controller = ControllerFactory::getController('Calls');
$controller->loadBean();
$controller->preProcess();
$controller->process();
//Manipulate view directly to not display header, js and footer again
$view = ViewFactory::loadView($controller->view, $controller->module, $controller->bean, $controller->view_object_map);
$view->options['show_header'] = false;
$view->options['show_title'] = false;
$view->options['show_javascript'] = false;
$view->process();
if ($GLOBALS['external_cache_enabled']) {
sugar_cache_clear('VIEW_CONFIG_FILE_Calls_TYPE_list');
}
die;
}
示例7: mark_deleted
/**
* Same as SugarBean::mark_deleted except clears api cache.
* @param $id
*/
public function mark_deleted($id)
{
sugar_cache_clear('currency_list');
$return = parent::mark_deleted($id);
// The per-module cache doesn't need to be cleared here
MetaDataManager::refreshSectionCache(array(MetaDataManager::MM_CURRENCIES));
}
示例8: action_DeployPackage
function action_DeployPackage()
{
if (defined('TEMPLATE_URL')) {
sugar_cache_reset();
SugarTemplateUtilities::disableCache();
}
$mb = new ModuleBuilder();
$load = $_REQUEST['package'];
$message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED'];
if (!empty($load)) {
$zip = $mb->getPackage($load);
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$info = $mb->packages[$load]->build(false);
mkdir_recursive($GLOBALS['sugar_config']['cache_dir'] . '/upload/upgrades/module/');
rename($info['zip'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip');
copy($info['manifest'], $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '-manifest.php');
$_REQUEST['install_file'] = $GLOBALS['sugar_config']['cache_dir'] . '/' . 'upload/upgrades/module/' . $info['name'] . '.zip';
$GLOBALS['mi_remove_tables'] = false;
$pm->performUninstall($load);
//#23177 , js cache clear
clearAllJsAndJsLangFilesWithoutOutput();
//#30747, clear the cache in memoy
$cache_key = 'app_list_strings.' . $GLOBALS['current_language'];
sugar_cache_clear($cache_key);
sugar_cache_reset();
//clear end
$pm->performInstall($_REQUEST['install_file']);
}
echo 'complete';
}
示例9: action_DeployPackage
function action_DeployPackage()
{
global $current_user;
if (defined('TEMPLATE_URL')) {
sugar_cache_reset();
SugarTemplateUtilities::disableCache();
}
//increment etag for menu so the new module shows up when the AJAX UI reloads
$current_user->incrementETag("mainMenuETag");
$mb = new ModuleBuilder();
$load = $_REQUEST['package'];
$message = $GLOBALS['mod_strings']['LBL_MODULE_DEPLOYED'];
if (!empty($load)) {
$zip = $mb->getPackage($load);
require_once 'ModuleInstall/PackageManager/PackageManager.php';
$pm = new PackageManager();
$info = $mb->packages[$load]->build(false);
$uploadDir = $pm->upload_dir . '/upgrades/module/';
mkdir_recursive($uploadDir);
rename($info['zip'], $uploadDir . $info['name'] . '.zip');
copy($info['manifest'], $uploadDir . $info['name'] . '-manifest.php');
$_REQUEST['install_file'] = $uploadDir . $info['name'] . '.zip';
$GLOBALS['mi_remove_tables'] = false;
$pm->performUninstall($load);
//#23177 , js cache clear
clearAllJsAndJsLangFilesWithoutOutput();
//#30747, clear the cache in memory
$cache_key = 'app_list_strings.' . $GLOBALS['current_language'];
sugar_cache_clear($cache_key);
sugar_cache_reset();
//clear end
$pm->performInstall($_REQUEST['install_file'], true);
//clear the unified_search_module.php file
require_once 'modules/Home/UnifiedSearchAdvanced.php';
UnifiedSearchAdvanced::unlinkUnifiedSearchModulesFile();
//bug 44269 - start
//clear workflow admin modules cache
if (isset($_SESSION['get_workflow_admin_modules_for_user'])) {
unset($_SESSION['get_workflow_admin_modules_for_user']);
}
//clear "is_admin_for_module" cache
$sessionVar = 'MLA_' . $current_user->user_name;
foreach ($mb->packages as $package) {
foreach ($package->modules as $module) {
$_SESSION[$sessionVar][$package->name . '_' . $module->name] = true;
}
}
//recreate acl cache
$actions = ACLAction::getUserActions($current_user->id, true);
//bug 44269 - end
}
echo 'complete';
}
示例10: save_custom_app_list_strings
/**
* @return bool
* @param app_list_strings array
* @desc Saves the app_list_strings to file in the 'custom' dir.
*/
function save_custom_app_list_strings(&$app_list_strings, $language)
{
$return_value = false;
$dirname = 'custom/include/language';
$dir_exists = is_dir($dirname);
if (!$dir_exists) {
$dir_exists = create_include_lang_dir($dirname);
}
if ($dir_exists) {
$filename = "{$dirname}/{$language}.lang.php";
$handle = @sugar_fopen($filename, 'wt');
if ($handle) {
$contents = create_dropdown_lang_pak_contents($app_list_strings, $language);
if (fwrite($handle, $contents)) {
$return_value = true;
$GLOBALS['log']->info("Successful write to: {$filename}");
}
fclose($handle);
} else {
$GLOBALS['log']->info("Unable to write edited language pak to file: {$filename}");
}
} else {
$GLOBALS['log']->info("Unable to create dir: {$dirname}");
}
if ($return_value) {
$cache_key = 'app_list_strings.' . $language;
sugar_cache_clear($cache_key);
}
return $return_value;
}
示例11: action_SaveLabel
public function action_SaveLabel()
{
if (!empty($_REQUEST['view_module']) && !empty($_REQUEST['labelValue'])) {
$_REQUEST["label_" . $_REQUEST['label']] = $_REQUEST['labelValue'];
// Since the following loop will change aspects of the $_REQUEST
// array read it into a copy to preserve state on $_REQUEST
$req = $_REQUEST;
foreach (ModuleBuilder::getModuleAliases($_REQUEST['view_module']) as $key) {
$req['view_module'] = $key;
$parser = new ParserLabel($req['view_module'], isset($req['view_package']) ? $req['view_package'] : null);
$parser->handleSave($req, $GLOBALS['current_language']);
// Clear the language cache to make sure the view picks up the latest
$cache_key = LanguageManager::getLanguageCacheKey($req['view_module'], $GLOBALS['current_language']);
sugar_cache_clear($cache_key);
}
MetaDataManager::refreshSectionCache(MetaDataManager::MM_LABELS);
MetaDataManager::refreshSectionCache(MetaDataManager::MM_ORDEREDLABELS);
}
$this->view = 'modulefields';
}
示例12: clearLanguageCache
/**
* Remove the language cache files from cache/modules/<module>/language
*/
public function clearLanguageCache()
{
global $mod_strings;
if ($this->show_output) {
echo "<h3>{$mod_strings['LBL_QR_CLEARLANG']}</h3>";
}
//clear cache using the list $module_list_from_cache
if (!empty($this->module_list) && is_array($this->module_list)) {
if (in_array(translate('LBL_ALL_MODULES'), $this->module_list)) {
LanguageManager::clearLanguageCache();
} else {
//use the modules selected thrut the select list.
foreach ($this->module_list as $module_name) {
LanguageManager::clearLanguageCache($module_name);
}
}
}
// Clear app* cache values too
if (!empty($GLOBALS['sugar_config']['languages'])) {
$languages = $GLOBALS['sugar_config']['languages'];
} else {
$languages = array($GLOBALS['current_language'] => $GLOBALS['current_language']);
}
foreach (array_keys($languages) as $language) {
sugar_cache_clear('app_strings.' . $language);
sugar_cache_clear('app_list_strings.' . $language);
}
}
示例13: testBuildMergeLink
public function testBuildMergeLink()
{
$this->_lvd->seed = new stdClass();
$this->_lvd->seed->module_dir = 'foobarfoobar';
$GLOBALS['current_user']->setPreference('mailmerge_on', 'on');
$settings_cache = sugar_cache_retrieve('admin_settings_cache');
if (empty($settings_cache)) {
$settings_cache = array();
}
$settings_cache['system_mailmerge_on'] = true;
sugar_cache_put('admin_settings_cache', $settings_cache);
$output = $this->_lvd->buildMergeLink(array('foobarfoobar' => 'foobarfoobar'));
$this->assertContains("index.php?action=index&module=MailMerge&entire=true", $output);
sugar_cache_clear('admin_settings_cache');
}
示例14: _clearCache
/**
* PRIVATE function used within clearLanguageCache so we do not repeat logic
* @param string module_dir the module_dir to clear
* @param string lang the name of the language file we are clearing this is for sugar_cache
*/
function _clearCache($module_dir = '', $lang)
{
if (!empty($module_dir) && !empty($lang)) {
$file = sugar_cached('modules/') . $module_dir . '/language/' . $lang . '.lang.php';
if (file_exists($file)) {
unlink($file);
$key = self::getLanguageCacheKey($module_dir, $lang);
sugar_cache_clear($key);
}
}
}
示例15: action_updatewirelessenabledmodules
public function action_updatewirelessenabledmodules()
{
require_once 'modules/Administration/Forms.php';
global $app_strings, $current_user, $moduleList;
if (!is_admin($current_user)) {
sugar_die($app_strings['ERR_NOT_ADMIN']);
}
require_once 'modules/Configurator/Configurator.php';
$configurator = new Configurator();
$configurator->saveConfig();
if (isset($_REQUEST['enabled_modules']) && !empty($_REQUEST['enabled_modules'])) {
$updated_enabled_modules = array();
$wireless_module_registry = array();
$file = 'include/MVC/Controller/wireless_module_registry.php';
if (SugarAutoLoader::fileExists($file)) {
require $file;
}
foreach (explode(',', $_REQUEST['enabled_modules']) as $moduleName) {
$moduleDef = array_key_exists($moduleName, $wireless_module_registry) ? $wireless_module_registry[$moduleName] : array();
$updated_enabled_modules[$moduleName] = $moduleDef;
}
$filename = create_custom_directory('include/MVC/Controller/wireless_module_registry.php');
mkdir_recursive(dirname($filename));
write_array_to_file('wireless_module_registry', $updated_enabled_modules, $filename);
foreach ($moduleList as $mod) {
sugar_cache_clear("CONTROLLER_wireless_module_registry_{$mod}");
}
//Users doesn't appear in the normal module list, but its value is cached on login.
sugar_cache_clear("CONTROLLER_wireless_module_registry_Users");
sugar_cache_reset();
// Bug 59121 - Clear the metadata cache for the mobile platform
MetaDataManager::refreshCache(array('mobile'));
}
echo "true";
}