本文整理汇总了PHP中SugarApplication::preLoadLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarApplication::preLoadLanguages方法的具体用法?PHP SugarApplication::preLoadLanguages怎么用?PHP SugarApplication::preLoadLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarApplication
的用法示例。
在下文中一共展示了SugarApplication::preLoadLanguages方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: initSugar
/**
* Initialize Sugar environment
*/
protected function initSugar()
{
if ($this->sugar_initialized) {
return;
}
// BR-385 - This fixes the issues around SugarThemeRegistry fatals. The cache needs rebuild on stage-post init of sugar
if ($this->current_stage == 'post') {
$this->cleanFileCache();
}
if (!defined('sugarEntry')) {
define('sugarEntry', true);
}
$this->log("Initializing SugarCRM environment");
global $beanFiles, $beanList, $objectList, $timedate, $moduleList, $modInvisList, $sugar_config, $locale, $sugar_version, $sugar_flavor, $sugar_build, $sugar_db_version, $sugar_timestamp, $db, $locale, $installing, $bwcModules, $app_list_strings, $modules_exempt_from_availability_check;
$installing = true;
include 'include/entryPoint.php';
$installing = false;
$GLOBALS['current_language'] = $this->config['default_language'];
if (empty($GLOBALS['current_language'])) {
$GLOBALS['current_language'] = 'en_us';
}
$GLOBALS['log'] = LoggerManager::getLogger('SugarCRM');
$this->db = $GLOBALS['db'] = DBManagerFactory::getInstance();
//Once we have a DB, we can do a full cache clear
if ($this->current_stage == 'post') {
$this->cleanCaches();
}
SugarApplication::preLoadLanguages();
$timedate = TimeDate::getInstance();
if (empty($locale)) {
if (method_exists('Localization', 'getObject')) {
$locale = Localization::getObject();
} else {
$locale = new Localization();
}
}
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = '';
}
// Load user
$GLOBALS['current_user'] = $this->getUser();
// Prepare DB
if ($this->config['dbconfig']['db_type'] == 'mysql') {
//Change the db wait_timeout for this session
$now_timeout = $this->db->getOne("select @@wait_timeout");
$this->db->query("set wait_timeout=28800");
$now_timeout = $this->db->getOne("select @@wait_timeout");
$this->log("DB timeout set to {$now_timeout}");
}
// stop trackers
$trackerManager = TrackerManager::getInstance(true);
$trackerManager->pause();
$trackerManager->unsetMonitors();
$this->sugar_initialized = true;
$this->loadStrings();
$GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
$this->log("Done initializing SugarCRM environment");
}
示例2: session_id
//// SETTING DEFAULT VAR VALUES
$GLOBALS['log'] = LoggerManager::getLogger();
$error_notice = '';
$use_current_user_login = false;
// Allow for the session information to be passed via the URL for printing.
if (isset($_GET['PHPSESSID'])) {
if (!empty($_COOKIE['PHPSESSID']) && strcmp($_GET['PHPSESSID'], $_COOKIE['PHPSESSID']) == 0) {
session_id($_REQUEST['PHPSESSID']);
} else {
unset($_GET['PHPSESSID']);
}
}
if (!empty($sugar_config['session_dir'])) {
session_save_path($sugar_config['session_dir']);
}
SugarApplication::preLoadLanguages();
$timedate = TimeDate::getInstance();
$GLOBALS['sugar_version'] = $sugar_version;
$GLOBALS['sugar_flavor'] = $sugar_flavor;
$GLOBALS['timedate'] = $timedate;
$GLOBALS['js_version_key'] = md5($GLOBALS['sugar_config']['unique_key'] . $GLOBALS['sugar_version'] . $GLOBALS['sugar_flavor']);
$db = DBManagerFactory::getInstance();
$db->resetQueryCount();
$locale = new Localization();
// Emails uses the REQUEST_URI later to construct dynamic URLs.
// IIS does not pass this field to prevent an error, if it is not set, we will assign it to ''.
if (!isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = '';
}
$current_user = new User();
$current_entity = null;
示例3: testpreLoadLanguages
public function testpreLoadLanguages()
{
try {
SugarApplication::preLoadLanguages();
//check that method call got the current_language global variable set.
$this->assertTrue(isset($GLOBALS['current_language']));
//check that method call got the app_strings global variable set.
$this->assertTrue(is_array($GLOBALS['app_strings']) && count($GLOBALS['app_strings']) > 0);
} catch (Exception $e) {
$this->fail();
}
}