public function reset_opcodes() { /* Bug 39354 - added function_exists check. Not optimal fix, but safe nonetheless. * This is for the upgrade to 6.1 from pre 6.1, since the utils files haven't been updated to 6.1 when this is called, * but this file has been updated to 6.1 */ if (function_exists('sugar_clean_opcodes')) { sugar_clean_opcodes(); } }
/** * Turn off external caching for the rest of this round trip and for all round * trips for the next cache timeout. This function should be called when global arrays * are affected (studio, module loader, upgrade wizard, ... ) and it is not ok to * wait for the cache to expire in order to see the change. */ function sugar_cache_reset() { //@todo implement this in new code // Set a flag to clear the code. sugar_cache_put('EXTERNAL_CACHE_RESET', true); // Clear the local cache $GLOBALS['cache_local_store'] = array(); // Disable the external cache for the rest of the round trip $GLOBALS['external_cache_enabled'] = false; sugar_clean_opcodes(); }
function sugar_cache_reset_full() { Cache::flush(); sugar_clean_opcodes(); }
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) { sugar_clean_opcodes(); $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; }