本文整理汇总了PHP中LanguageManager::clearLanguageCache方法的典型用法代码示例。如果您正苦于以下问题:PHP LanguageManager::clearLanguageCache方法的具体用法?PHP LanguageManager::clearLanguageCache怎么用?PHP LanguageManager::clearLanguageCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LanguageManager
的用法示例。
在下文中一共展示了LanguageManager::clearLanguageCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
if (empty($this->upgrader->config['js_lang_version'])) {
$this->upgrader->config['js_lang_version'] = 1;
} else {
$this->upgrader->config['js_lang_version'] += 1;
}
//remove lanugage cache files
require_once 'include/SugarObjects/LanguageManager.php';
LanguageManager::clearLanguageCache();
}
示例2: removeCustomLabels
function removeCustomLabels()
{
$out = "";
$languageDir = "custom/modules/{$this->module}/language";
if (is_dir($languageDir)) {
$files = scandir($languageDir);
foreach ($files as $langFile) {
if (substr($langFile, 0, 1) == '.') {
continue;
}
$language = substr($langFile, 0, strlen($langFile) - 9);
unlink($languageDir . "/" . $langFile);
LanguageManager::clearLanguageCache($this->module, $language);
$out .= "Removed language file {$langFile}<br/>";
}
}
return $out;
}
示例3: 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);
}
}
示例4: deleteRelationship
private function deleteRelationship($lhs_module, $rhs_module = null, $rel_name = null)
{
$rhs_module = $rhs_module == null ? $lhs_module : $rhs_module;
$this->relationships = new DeployedRelationships($lhs_module);
$this->relationships->delete($rel_name !== null ? $rel_name : $this->relationship->getName());
$this->relationships->save();
SugarRelationshipFactory::deleteCache();
LanguageManager::clearLanguageCache($lhs_module);
if ($lhs_module != $rhs_module) {
LanguageManager::clearLanguageCache($rhs_module);
}
}
示例5: clearLanguageCaches
/**
* Clear all related language cache files.
*
* @return void
*/
private function clearLanguageCaches()
{
//remove the js language files
LanguageManager::removeJSLanguageFiles();
//remove lanugage cache files
LanguageManager::clearLanguageCache();
}
示例6: tearDown_relation
/**
* Doing the same things like setUp but for initialized list of modules
*
* @static
* @return bool are caches refreshed or not
*/
protected static function tearDown_relation()
{
SugarRelationshipFactory::deleteCache();
$modules = array_unique(self::$cleanModules);
foreach ($modules as $module) {
LanguageManager::clearLanguageCache($module);
}
self::tearDown('dictionary');
VardefManager::$linkFields = array();
VardefManager::clearVardef();
foreach ($modules as $module) {
VardefManager::refreshVardefs($module, BeanFactory::getBeanName($module));
}
SugarRelationshipFactory::rebuildCache();
self::$cleanModules = array();
return true;
}
示例7: addLabels
static function addLabels($language, $labels, $moduleName, $basepath = null)
{
$GLOBALS['log']->debug("ParserLabel->addLabels({$language}, \$labels, {$moduleName}, {$basepath} );");
$GLOBALS['log']->debug("\$labels:" . print_r($labels, true));
$deployedModule = false;
if (is_null($basepath)) {
$deployedModule = true;
$basepath = "custom/modules/{$moduleName}/language";
if (!is_dir($basepath)) {
require_once 'modules/Administration/Common.php';
create_module_lang_dir($moduleName);
}
}
$filename = "{$basepath}/{$language}.lang.php";
$dir_exists = is_dir($basepath);
$mod_strings = array();
if ($dir_exists) {
if (file_exists($filename)) {
// obtain $mod_strings
include $filename;
}
} else {
return false;
}
$changed = false;
//$charset = (isset($app_strings['LBL_CHARSET'])) ? $app_strings['LBL_CHARSET'] : $GLOBALS['sugar_config']['default_charset'] ;
foreach ($labels as $key => $value) {
if (!isset($mod_strings[$key]) || strcmp($value, $mod_strings[$key]) != 0) {
$mod_strings[$key] = html_entity_decode_utf8($value, ENT_QUOTES);
// must match encoding used in view.labels.php
$changed = true;
}
}
if ($changed) {
$GLOBALS['log']->debug("ParserLabel->addLabels: writing new mod_strings to {$filename}");
$GLOBALS['log']->debug("ParserLabel->addLabels: mod_strings=" . print_r($mod_strings, true));
if (!write_array_to_file("mod_strings", $mod_strings, $filename)) {
$GLOBALS['log']->fatal("Could not write {$filename}");
} else {
// if we have a cache to worry about, then clear it now
if ($deployedModule) {
$GLOBALS['log']->debug("PaserLabel->addLabels: clearing language cache");
$cache_key = "module_language." . $language . $moduleName;
sugar_cache_clear($cache_key);
LanguageManager::clearLanguageCache($moduleName, $language);
}
}
}
return true;
}
示例8: foreach
foreach ($_SESSION['sugarMergeRunResults'] as $mergeModule => $mergeModuleFileList) {
if (!empty($mergeModuleFileList)) {
$skipLayouts = false;
}
}
$stepNext = $skipLayouts ? $_REQUEST['step'] + 2 : $_REQUEST['step'] + 1;
$stepCancel = -1;
$stepRecheck = $_REQUEST['step'];
$_SESSION['step'][$steps['files'][$_REQUEST['step']]] = $stop ? 'failed' : 'success';
// clear out the theme cache
if (!class_exists('SugarThemeRegistry')) {
require_once 'include/SugarTheme/SugarTheme.php';
}
$themeObject = SugarThemeRegistry::current();
$styleJSFilePath = $GLOBALS['sugar_config']['cache_dir'] . $themeObject->getJSPath() . DIRECTORY_SEPARATOR . 'style-min.js';
if (file_exists($styleJSFilePath)) {
logThis("Rebuilding style js file: {$styleJSFilePath}");
unlink($styleJSFilePath);
SugarThemeRegistry::current()->clearJSCache();
SugarThemeRegistry::current()->getJS();
}
SugarThemeRegistry::buildRegistry();
SugarThemeRegistry::clearAllCaches();
//Clean out the language files
logThis("Rebuilding language cache");
sugar_cache_reset_full();
LanguageManager::clearLanguageCache();
// re-minify the JS source files
$_REQUEST['root_directory'] = getcwd();
$_REQUEST['js_rebuild_concat'] = 'rebuild';
require_once 'jssource/minify.php';
示例9: action_SaveRelationship
public function action_SaveRelationship()
{
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
if (empty($_REQUEST['view_package'])) {
$relationships = new DeployedRelationships($_REQUEST['view_module']);
} else {
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
$relationships = new UndeployedRelationships($module->getModuleDir());
}
$relationships->addFromPost();
// Since the build() call below will call save() again, save the rebuild
// of relationship metadata for now
$relationships->save(false);
$GLOBALS['log']->debug("\n\nSTART BUILD");
if (empty($_REQUEST['view_package'])) {
$relationships->build();
LanguageManager::clearLanguageCache($_REQUEST['view_module']);
}
$GLOBALS['log']->debug("\n\nEND BUILD");
$this->view = 'relationships';
}
示例10: addLabels
static function addLabels($currLanguage, $labels, $moduleName, $basepath = null)
{
$GLOBALS['log']->debug("ParserLabel->addLabels({$currLanguage}, \$labels, {$moduleName}, {$basepath} );");
$GLOBALS['log']->debug("\$labels:" . print_r($labels, true));
$languages = get_languages();
foreach ($languages as $language => $langlabel) {
$currentLabels = self::getCustomLabels($language, $moduleName, $basepath);
if ($currentLabels === false) {
return false;
}
//Unable to create a custom folder.
$mod_strings = $currentLabels['labels'];
$changed = false;
foreach ($labels as $key => $value) {
if (!isset($mod_strings[$key]) || strcmp($value, $mod_strings[$key]) != 0 && $language == $currLanguage) {
$mod_strings[$key] = html_entity_decode_utf8($value, ENT_QUOTES);
// must match encoding used in view.labels.php
$changed = true;
}
}
if ($changed) {
$GLOBALS['log']->debug("ParserLabel->addLabels: writing new mod_strings to {$currentLabels['file']}");
$GLOBALS['log']->debug("ParserLabel->addLabels: mod_strings=" . print_r($mod_strings, true));
if (!write_array_to_file("mod_strings", $mod_strings, $currentLabels["file"])) {
$GLOBALS['log']->fatal("Could not write {$currentLabels['file']}");
} else {
// if we have a cache to worry about, then clear it now
if ($currentLabels['deployed']) {
$GLOBALS['log']->debug("PaserLabel->addLabels: clearing language cache");
$cache_key = "module_language." . $language . $moduleName;
sugar_cache_clear($cache_key);
LanguageManager::clearLanguageCache($moduleName, $language);
}
}
}
}
return true;
}
示例11: addLabels
/**
* Add a set of labels to the language pack for a module, deployed or undeployed
*
* @param string $language Language key, for example 'en_us'
* @param array $labels The labels to add in the form of an array of System label => Display label pairs
* @param string $moduleName Name of the module to which to add these labels
* @param string $basepath Basepath to the file to be written to
*/
public static function addLabels($language, $labels, $moduleName, $basepath = null)
{
$GLOBALS['log']->debug("ParserLabel->addLabels({$language}, \$labels, {$moduleName}, {$basepath});");
$GLOBALS['log']->debug("\$labels:" . print_r($labels, true));
$deployedModule = false;
if (is_null($basepath)) {
$deployedModule = true;
$basepath = "custom/Extension/modules/{$moduleName}/Ext/Language";
if (!SugarAutoLoader::fileExists($basepath)) {
mkdir_recursive($basepath);
}
}
$filename = "{$basepath}/{$language}.lang.php";
$mod_strings = array();
$changed = false;
if (SugarAutoLoader::fileExists($basepath)) {
if (SugarAutoLoader::fileExists($filename)) {
// Get the current $mod_strings
include $filename;
}
foreach ($labels as $key => $value) {
if (!isset($mod_strings[$key]) || strcmp($value, $mod_strings[$key]) != 0) {
// Must match encoding used in view.labels.php
$mod_strings[$key] = to_html(strip_tags(from_html($value)));
$changed = true;
}
}
} else {
$changed = true;
}
if (!empty($mod_strings) && $changed) {
$GLOBALS['log']->debug("ParserLabel->addLabels: writing new mod_strings to {$filename}");
$GLOBALS['log']->debug("ParserLabel->addLabels: mod_strings=" . print_r($mod_strings, true));
$write = "<?php\n// WARNING: The contents of this file are auto-generated.\n";
// We can't use normal array writing here since multiple files can be
// structured differently. This is dirty, yes, but necessary.
foreach ($mod_strings as $k => $v) {
$write .= "\$mod_strings['{$k}'] = " . var_export($v, 1) . ";\n";
}
if (!SugarAutoLoader::put($filename, $write, true)) {
$GLOBALS['log']->fatal("Could not write {$filename}");
} else {
// if we have a cache to worry about, then clear it now
if ($deployedModule) {
SugarCache::cleanOpcodes();
$GLOBALS['log']->debug("PaserLabel->addLabels: clearing language cache");
self::rebuildLanguageExtensions($language, $moduleName);
$cache_key = "module_language." . $language . $moduleName;
sugar_cache_clear($cache_key);
LanguageManager::clearLanguageCache($moduleName, $language);
MetaDataManager::refreshLanguagesCache($language);
}
}
}
return true;
}
示例12: addLabels
static function addLabels ($language , $labels , $moduleName , $basepath = null, $forRelationshipLabel = false)
{
$GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels($language, \$labels, $moduleName, $basepath );" ) ;
$GLOBALS [ 'log' ]->debug ( "\$labels:" . print_r ( $labels, true ) ) ;
$deployedModule = false ;
if (is_null ( $basepath ))
{
$deployedModule = true ;
$basepath = "custom/modules/$moduleName/language" ;
if($forRelationshipLabel){
$basepath = "custom/modules/$moduleName/Ext/Language" ;
}
if (! is_dir ( $basepath ))
{
mkdir_recursive($basepath);
}
}
$filename = "$basepath/$language.lang.php" ;
if($forRelationshipLabel){
$filename = "$basepath/$language.lang.ext.php" ;
}
$dir_exists = is_dir ( $basepath ) ;
$mod_strings = array ( ) ;
if ($dir_exists)
{
if (file_exists ( $filename ))
{
// obtain $mod_strings
include ($filename) ;
}else if($forRelationshipLabel){
$fh = fopen ($filename, 'a');
fclose($fh);
}
} else
{
return false ;
}
$changed = false ;
//$charset = (isset($app_strings['LBL_CHARSET'])) ? $app_strings['LBL_CHARSET'] : $GLOBALS['sugar_config']['default_charset'] ;
foreach ( $labels as $key => $value )
{
if (! isset ( $mod_strings [ $key ] ) || strcmp ( $value, $mod_strings [ $key ] ) != 0)
{
$mod_strings [$key] = to_html(strip_tags(from_html($value))); // must match encoding used in view.labels.php
$changed = true ;
}
}
if ($changed)
{
$GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: writing new mod_strings to $filename" ) ;
$GLOBALS [ 'log' ]->debug ( "ParserLabel->addLabels: mod_strings=".print_r($mod_strings,true) ) ;
if (! write_array_to_file ( "mod_strings", $mod_strings, $filename ))
{
$GLOBALS [ 'log' ]->fatal ( "Could not write $filename" ) ;
} else
{
// if we have a cache to worry about, then clear it now
if ($deployedModule)
{
SugarCache::cleanOpcodes();
$GLOBALS [ 'log' ]->debug ( "PaserLabel->addLabels: clearing language cache" ) ;
$cache_key = "module_language." . $language . $moduleName ;
sugar_cache_clear ( $cache_key ) ;
LanguageManager::clearLanguageCache ( $moduleName, $language ) ;
}
}
}
// Fix for bug #51
// when the label is recreated it defaults back to the original value (In this case its "User").
// Solution:
// 1. Changes to the label names should go to custom/Extension/modules/{ModuleName}/Ext/Language
// This is done in case different users edit the same Relationship concurrently.
// The changes from custom/Extension/modules/{ModuleName}/Ext/Language
// will overwrite stuff in custom/modules/{ModuleName}/Ext/Language/en_us.lang.ext.php after
// Quick Repair and Rebuild is applied.
if($forRelationshipLabel) {
if(!empty($_POST[view_module]) && !empty($_POST[relationship_name]) && !empty($_POST[rhs_label]) && !empty($_POST[lhs_module])) {
// 1. Overwrite custom/Extension/modules/{ModuleName}/Ext/Language
$extension_basepath = "custom/Extension/modules/" . $_POST[view_module] . "/Ext/Language";
mkdir_recursive($extension_basepath);
$headerString = "<?php\n//THIS FILE IS AUTO GENERATED, DO NOT MODIFY\n";
$out = $headerString;
$extension_filename = "$extension_basepath/$language.custom" . $_POST[relationship_name] . ".php";
$mod_strings = array();
if (file_exists($extension_filename)) {
// obtain $mod_strings
//.........这里部分代码省略.........
示例13: rebuild_js_lang
function rebuild_js_lang()
{
require_once 'include/utils/file_utils.php';
global $sugar_config;
$jsFiles = array();
getFiles($jsFiles, $sugar_config['cache_dir'] . 'jsLanguage');
foreach ($jsFiles as $file) {
unlink($file);
}
if (empty($sugar_config['js_lang_version'])) {
$sugar_config['js_lang_version'] = 1;
} else {
$sugar_config['js_lang_version'] += 1;
}
write_array_to_file("sugar_config", $sugar_config, "config.php");
//remove lanugage cache files
require_once 'include/SugarObjects/LanguageManager.php';
LanguageManager::clearLanguageCache();
}
示例14: action_SaveRelationship
function action_SaveRelationship()
{
if (!empty($GLOBALS['current_user']) && empty($GLOBALS['modListHeader'])) {
$GLOBALS['modListHeader'] = query_module_access_list($GLOBALS['current_user']);
}
if (empty($_REQUEST['view_package'])) {
require_once 'modules/ModuleBuilder/parsers/relationships/DeployedRelationships.php';
$relationships = new DeployedRelationships($_REQUEST['view_module']);
} else {
$mb = new ModuleBuilder();
$module =& $mb->getPackageModule($_REQUEST['view_package'], $_REQUEST['view_module']);
require_once 'modules/ModuleBuilder/parsers/relationships/UndeployedRelationships.php';
$relationships = new UndeployedRelationships($module->getModuleDir());
}
$relationships->addFromPost();
$relationships->save();
$GLOBALS['log']->debug("\n\nSTART BUILD");
if (empty($_REQUEST['view_package'])) {
$relationships->build();
LanguageManager::clearLanguageCache($_REQUEST['view_module']);
}
$GLOBALS['log']->debug("\n\nEND BUILD");
$this->view = 'relationships';
}
示例15: 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);
}
}
}
}