本文整理汇总了PHP中LanguageManager::_clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::_clearCache方法的具体用法?PHP LanguageManager::_clearCache怎么用?PHP LanguageManager::_clearCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::_clearCache方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearLanguageCache
/**
* clear out the language cache.
* @param string module_dir the module_dir to clear, if not specified then clear
* clear language cache for all modules.
* @param string lang the name of the object we are clearing this is for sugar_cache
*/
public static function clearLanguageCache($module_dir = '', $lang = '')
{
if (empty($lang)) {
$languages = array_keys($GLOBALS['sugar_config']['languages']);
} else {
$languages = array($lang);
}
//if we have a module name specified then just remove that language file
//otherwise go through each module and clean up the language
if (!empty($module_dir)) {
foreach ($languages as $clean_lang) {
LanguageManager::_clearCache($module_dir, $clean_lang);
}
} else {
$cache_dir = sugar_cached('modules');
if (file_exists($cache_dir)) {
foreach (glob("{$cache_dir}/*", GLOB_ONLYDIR | GLOB_NOSORT) as $entry) {
$module = basename($entry);
foreach ($languages as $clean_lang) {
LanguageManager::_clearCache($module, $clean_lang);
}
}
}
}
}
示例2: clearLanguageCache
/**
* clear out the language cache.
* @param string module_dir the module_dir to clear, if not specified then clear
* clear language cache for all modules.
* @param string lang the name of the object we are clearing this is for sugar_cache
*/
function clearLanguageCache($module_dir = '', $lang = '')
{
if (empty($lang)) {
$languages = array_keys($GLOBALS['sugar_config']['languages']);
} else {
$languages = array($lang);
}
//if we have a module name specified then just remove that language file
//otherwise go through each module and clean up the language
if (!empty($module_dir)) {
foreach ($languages as $clean_lang) {
LanguageManager::_clearCache($module_dir, $clean_lang);
}
} else {
$cache_dir = sugar_cached('modules/');
if (file_exists($cache_dir) && ($dir = @opendir($cache_dir))) {
while (($entry = readdir($dir)) !== false) {
if ($entry == "." || $entry == "..") {
continue;
}
foreach ($languages as $clean_lang) {
LanguageManager::_clearCache($entry, $clean_lang);
}
}
closedir($dir);
}
}
}
示例3: clearLanguageCache
/**
* clear out the language cache.
* @param string module_dir the module_dir to clear, if not specified then clear
* clear vardef cache for all modules.
* @param string lang the name of the object we are clearing this is for sugar_cache
*/
function clearLanguageCache($module_dir = '', $lang = '')
{
if (empty($lang)) {
$lang = $GLOBALS['sugar_config']['default_language'];
}
//if we have a module name specified then just remove that vardef file
//otherwise go through each module and remove the vardefs.php
if (!empty($module_dir)) {
LanguageManager::_clearCache($module_dir, $lang);
} else {
global $beanList;
foreach ($beanList as $module_dir => $object_name) {
LanguageManager::_clearCache($module_dir, $lang);
}
}
}