本文整理汇总了PHP中TrackerManager::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP TrackerManager::getInstance方法的具体用法?PHP TrackerManager::getInstance怎么用?PHP TrackerManager::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrackerManager
的用法示例。
在下文中一共展示了TrackerManager::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOrderBy
/**
* checks the request for the order by and if that is not set then it checks the session for it
*
* @return array containing the keys orderBy => field being ordered off of and sortOrder => the sort order of that field
*/
function getOrderBy($orderBy = '', $direction = '')
{
if (!empty($orderBy) || !empty($_REQUEST[$this->var_order_by])) {
if (!empty($_REQUEST[$this->var_order_by])) {
$direction = 'ASC';
$orderBy = $_REQUEST[$this->var_order_by];
if (!empty($_REQUEST['lvso']) && (empty($_SESSION['lvd']['last_ob']) || strcmp($orderBy, $_SESSION['lvd']['last_ob']) == 0)) {
$direction = $_REQUEST['lvso'];
$trackerManager = TrackerManager::getInstance();
if ($monitor = $trackerManager->getMonitor('tracker')) {
$monitor->setValue('module_name', $GLOBALS['module']);
$monitor->setValue('item_summary', "lvso=" . $direction . "&" . $this->var_order_by . "=" . $_REQUEST[$this->var_order_by]);
$monitor->setValue('action', 'listview');
$monitor->setValue('user_id', $GLOBALS['current_user']->id);
$monitor->setValue('date_modified', gmdate($GLOBALS['timedate']->get_db_date_time_format()));
$monitor->save();
}
}
}
$_SESSION[$this->var_order_by] = array('orderBy' => $orderBy, 'direction' => $direction);
$_SESSION['lvd']['last_ob'] = $orderBy;
} else {
if (!empty($_SESSION[$this->var_order_by])) {
$orderBy = $_SESSION[$this->var_order_by]['orderBy'];
$direction = $_SESSION[$this->var_order_by]['direction'];
}
}
return array('orderBy' => $orderBy, 'sortOrder' => $direction);
}
示例2: start
function start()
{
$this->db = DBManagerFactory::getInstance();
$this->userDemoData = new UserDemoData($this->user, false);
$this->trackerManager = TrackerManager::getInstance();
foreach ($this->modules as $mod) {
$query = "select id from {$mod}";
$result = $this->db->limitQuery($query, 0, 50);
$ids = array();
while ($row = $this->db->fetchByAssoc($result)) {
$ids[] = $row['id'];
}
//while
$this->beanIdMap[$mod] = $ids;
}
while ($this->monitorIds-- > 0) {
$this->monitorId = create_guid();
$this->trackerManager->setMonitorId($this->monitorId);
$this->user = $this->userDemoData->guids[array_rand($this->userDemoData->guids)];
$this->module = $this->modules[array_rand($this->modules)];
$this->action = $this->actions[array_rand($this->actions)];
$this->date = $this->randomTimestamp();
$this->populate_tracker();
$this->populate_tracker_perf();
$this->populate_tracker_sessions();
$this->populate_tracker_queries();
$this->trackerManager->save();
}
}
示例3: insertTrackerEntry
public static function insertTrackerEntry($bean, $action)
{
require_once 'modules/Trackers/TrackerManager.php';
$trackerManager = TrackerManager::getInstance();
$timeStamp = gmdate($GLOBALS['timedate']->get_db_date_time_format());
$_REQUEST['action'] = $action;
if ($monitor = $trackerManager->getMonitor('tracker')) {
$monitor->setValue('action', $action);
$monitor->setValue('user_id', $GLOBALS['current_user']->id);
$monitor->setValue('module_name', $bean->module_dir);
$monitor->setValue('date_modified', $timeStamp);
$monitor->setValue('visible', $action == 'detailview' || $action == 'editview' ? 1 : 0);
if (!empty($bean->id)) {
$monitor->setValue('item_id', $bean->id);
$monitor->setValue('item_summary', $bean->get_summary_text());
}
//If visible is true, but there is no bean, do not track (invalid/unauthorized reference)
//Also, do not track save actions where there is no bean id
if ($monitor->visible && empty($bean->id)) {
$trackerManager->unsetMonitor($monitor);
return false;
}
$trackerManager->saveMonitor($monitor, true, true);
if (empty(self::$_monitorId)) {
self::$_monitorId = $monitor->monitor_id;
}
}
}
示例4: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $app_strings;
$admin = Administration::getSettings();
require 'modules/Trackers/config.php';
///////////////////////////////////////////////////////////////////////////////
//// HANDLE CHANGES
if (isset($_POST['process'])) {
if ($_POST['process'] == 'true') {
foreach ($tracker_config as $entry) {
if (isset($entry['bean'])) {
//If checkbox is unchecked, we add the entry into the config table; otherwise delete it
if (empty($_POST[$entry['name']])) {
$admin->saveSetting('tracker', $entry['name'], 1);
} else {
$db = DBManagerFactory::getInstance();
$db->query("DELETE FROM config WHERE category = 'tracker' and name = '" . $entry['name'] . "'");
}
}
}
//foreach
//save the tracker prune interval
if (!empty($_POST['tracker_prune_interval'])) {
$admin->saveSetting('tracker', 'prune_interval', $_POST['tracker_prune_interval']);
}
//save log slow queries and slow query interval
$configurator = new Configurator();
$configurator->saveConfig();
}
//if
header('Location: index.php?module=Administration&action=index');
}
echo getClassicModuleTitle("Administration", array("<a href='index.php?module=Administration&action=index'>" . translate('LBL_MODULE_NAME', 'Administration') . "</a>", translate('LBL_TRACKER_SETTINGS', 'Administration')), false);
$trackerManager = TrackerManager::getInstance();
$disabledMonitors = $trackerManager->getDisabledMonitors();
$trackerEntries = array();
foreach ($tracker_config as $entry) {
if (isset($entry['bean'])) {
$disabled = !empty($disabledMonitors[$entry['name']]);
$trackerEntries[$entry['name']] = array('label' => $mod_strings['LBL_' . strtoupper($entry['name']) . '_DESC'], 'helpLabel' => $mod_strings['LBL_' . strtoupper($entry['name']) . '_HELP'], 'disabled' => $disabled);
}
}
$configurator = new Configurator();
$this->ss->assign('config', $configurator->config);
$config_strings = return_module_language($GLOBALS['current_language'], 'Configurator');
$mod_strings['LOG_SLOW_QUERIES'] = $config_strings['LOG_SLOW_QUERIES'];
$mod_strings['SLOW_QUERY_TIME_MSEC'] = $config_strings['SLOW_QUERY_TIME_MSEC'];
$this->ss->assign('mod', $mod_strings);
$this->ss->assign('app', $app_strings);
$this->ss->assign('trackerEntries', $trackerEntries);
$this->ss->assign('tracker_prune_interval', !empty($admin->settings['tracker_prune_interval']) ? $admin->settings['tracker_prune_interval'] : 30);
$this->ss->display('modules/Trackers/tpls/TrackerSettings.tpl');
}
示例5: trackView
/**
* Track a view for a particular bean.
*
* @param SugarBean $seed
* @param string $current_view
*/
function trackView($seed, $current_view)
{
$trackerManager = TrackerManager::getInstance();
if ($monitor = $trackerManager->getMonitor('tracker')) {
$monitor->setValue('date_modified', TimeDate::getInstance()->nowDb());
$monitor->setValue('user_id', $GLOBALS['current_user']->id);
$monitor->setValue('module_name', $seed->module_dir);
$monitor->setValue('action', $current_view);
$monitor->setValue('item_id', $seed->id);
$monitor->setValue('item_summary', $seed->get_summary_text());
$monitor->setValue('visible', true);
$trackerManager->saveMonitor($monitor, TRUE, TRUE);
}
}
示例6: __construct
public function __construct($importSource, $bean)
{
global $mod_strings, $sugar_config;
$this->importSource = $importSource;
//Vanilla copy of the bean object.
$this->bean = $bean;
// use our own error handler
set_error_handler(array('Importer', 'handleImportErrors'), E_ALL & ~E_STRICT & ~E_DEPRECATED);
// Increase the max_execution_time since this step can take awhile
ini_set("max_execution_time", max($sugar_config['import_max_execution_time'], 3600));
// stop the tracker
TrackerManager::getInstance()->pause();
// set the default locale settings
$this->ifs = $this->getFieldSanitizer();
//Get the default user currency
$this->defaultUserCurrency = BeanFactory::getBean('Currencies', '-99');
//Get our import column definitions
$this->importColumns = $this->getImportColumns();
$this->isUpdateOnly = isset($_REQUEST['import_type']) && $_REQUEST['import_type'] == 'update';
}
示例7: track_view
/**
* Tracks the viewing of a detail record.
* This leverages get_summary_text() which is object specific.
*
* Internal function, do not override.
* @param string $user_id - String value of the user that is viewing the record.
* @param string $current_module - String value of the module being processed.
* @param string $current_view - String value of the current view
*/
function track_view($user_id, $current_module, $current_view = '')
{
$trackerManager = TrackerManager::getInstance();
if ($monitor = $trackerManager->getMonitor('tracker')) {
$monitor->setValue('date_modified', $GLOBALS['timedate']->nowDb());
$monitor->setValue('user_id', $user_id);
$monitor->setValue('module_name', $current_module);
$monitor->setValue('action', $current_view);
$monitor->setValue('item_id', $this->id);
$monitor->setValue('item_summary', $this->get_summary_text());
$monitor->setValue('visible', $this->tracker_visibility);
$trackerManager->saveMonitor($monitor);
}
}
示例8: _track
/**
* track
* Private function to track information about the view request
*/
private function _track()
{
if (empty($this->responseTime)) {
$this->_calculateFooterMetrics();
}
if (empty($GLOBALS['current_user']->id)) {
return;
}
$trackerManager = TrackerManager::getInstance();
$trackerManager->save();
}
示例9: finishJob
/**
* This function takes a job_id, and updates schedulers last_run as well as
* soft delete the job instance from schedulers_times
* @return boolean Success
*/
function finishJob()
{
$trackerManager = TrackerManager::getInstance();
$trackerManager->pause();
$GLOBALS['log']->debug('----->SchedulersJob updating Job Status and finishing Job execution.');
$this->scheduler->retrieve($this->scheduler->id);
$this->scheduler->last_run = gmdate($GLOBALS['timedate']->get_db_date_time_format());
if ($this->scheduler->last_run == gmdate($GLOBALS['timedate']->get_db_date_time_format(), strtotime('Jan 01 2000 00:00:00'))) {
$this->scheduler->last_run = $this->handleDateFormat('now');
$GLOBALS['log']->fatal('Scheduler applying bogus date for "Last Run": ' . $this->scheduler->last_run);
}
$this->scheduler->save();
$trackerManager->unPause();
}
示例10: _track
/**
* track
* Private function to track information about the view request
*/
private function _track()
{
if (empty($this->responseTime)) {
$this->_calculateFooterMetrics();
}
if (empty($GLOBALS['current_user']->id)) {
return;
}
$trackerManager = TrackerManager::getInstance();
if (!$trackerManager->isPaused()) {
$timeStamp = TimeDate::getInstance()->nowDb();
//Track to tracker_perf
if ($monitor2 = $trackerManager->getMonitor('tracker_perf')) {
$monitor2->setValue('server_response_time', $this->responseTime);
$dbManager =& DBManagerFactory::getInstance();
$monitor2->db_round_trips = $dbManager->getQueryCount();
$monitor2->setValue('date_modified', $timeStamp);
$monitor2->setValue('db_round_trips', $dbManager->getQueryCount());
$monitor2->setValue('files_opened', $this->fileResources);
if (function_exists('memory_get_usage')) {
$monitor2->setValue('memory_usage', memory_get_usage());
}
}
// Track to tracker_sessions
if ($monitor3 = $trackerManager->getMonitor('tracker_sessions')) {
$monitor3->setValue('date_end', $timeStamp);
if (!isset($monitor3->date_start)) {
$monitor3->setValue('date_start', $timeStamp);
}
$seconds = strtotime($monitor3->date_end) - strtotime($monitor3->date_start);
$monitor3->setValue('seconds', $seconds);
$monitor3->setValue('user_id', $GLOBALS['current_user']->id);
}
}
$trackerManager->save();
}
示例11: handleSave
//.........这里部分代码省略.........
if (!empty($_POST['return_module'])) {
$get .= $_POST['return_module'];
} else {
$get .= 'xVendors';
}
$get .= '&return_action=';
if (!empty($_POST['return_action'])) {
$get .= $_POST['return_action'];
}
//else $get .= 'DetailView';
if (!empty($_POST['return_id'])) {
$get .= '&return_id=' . $_POST['return_id'];
}
if (!empty($_POST['popup'])) {
$get .= '&popup=' . $_POST['popup'];
}
if (!empty($_POST['create'])) {
$get .= '&create=' . $_POST['create'];
}
$_SESSION['SHOW_DUPLICATES'] = $get;
//now redirect the post to modules/xVendors/ShowDuplicates.php
if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
ob_clean();
$json = getJSONobj();
echo $json->encode(array('status' => 'dupe', 'get' => $location));
} else {
if (!empty($_REQUEST['ajax_load'])) {
echo "<script>SUGAR.ajaxUI.loadContent('index.php?{$location}');</script>";
} else {
if (!empty($_POST['to_pdf'])) {
$location .= '&to_pdf=' . $_POST['to_pdf'];
}
header("Location: index.php?{$location}");
}
}
return null;
}
}
if (!$focus->ACLAccess('Save')) {
ACLController::displayNoAccess(true);
sugar_cleanup(true);
}
$focus->save($check_notify);
$return_id = $focus->id;
$GLOBALS['log']->debug("Saved record with id of " . $return_id);
if (!empty($_POST['is_ajax_call']) && $_POST['is_ajax_call'] == '1') {
$json = getJSONobj();
echo $json->encode(array('status' => 'success', 'get' => ''));
$trackerManager = TrackerManager::getInstance();
$timeStamp = TimeDate::getInstance()->nowDb();
if ($monitor = $trackerManager->getMonitor('tracker')) {
$monitor->setValue('action', 'detailview');
$monitor->setValue('user_id', $GLOBALS['current_user']->id);
$monitor->setValue('module_name', 'xVendors');
$monitor->setValue('date_modified', $timeStamp);
$monitor->setValue('visible', 1);
if (!empty($this->bean->id)) {
$monitor->setValue('item_id', $return_id);
$monitor->setValue('item_summary', $focus->get_summary_text());
}
$trackerManager->saveMonitor($monitor, true, true);
}
return null;
}
if (isset($_POST['popup']) && $_POST['popup'] == 'true') {
$get = '&module=';
if (!empty($_POST['return_module'])) {
$get .= $_POST['return_module'];
} else {
$get .= 'xVendors';
}
$get .= '&action=';
if (!empty($_POST['return_action'])) {
$get .= $_POST['return_action'];
} else {
$get .= 'Popup';
}
if (!empty($_POST['return_id'])) {
$get .= '&return_id=' . $_POST['return_id'];
}
if (!empty($_POST['popup'])) {
$get .= '&popup=' . $_POST['popup'];
}
if (!empty($_POST['create'])) {
$get .= '&create=' . $_POST['create'];
}
if (!empty($_POST['to_pdf'])) {
$get .= '&to_pdf=' . $_POST['to_pdf'];
}
$get .= '&name=' . $focus->name;
$get .= '&query=true';
header("Location: index.php?{$get}");
return;
}
if ($redirect) {
handleRedirect($return_id, 'xVendors');
} else {
return $focus;
}
}
示例12: save
/**
* save
* This method retrieves the Store instances associated with monitor and calls
* the flush method passing with the montior ($this) instance.
*
*/
public function save($flush = true)
{
if (empty($this->date_modified)) {
$this->date_modified = $GLOBALS['timedate']->nowDb();
}
$this->cached_data[] = $this->toArray();
if ($flush && empty($GLOBALS['tracker_' . $this->table_name]) && !empty($this->cached_data)) {
require_once 'modules/Trackers/TrackerUtility.php';
$write_entries = array();
foreach ($this->cached_data as $entry) {
$query = str_replace(array("\r", "\n", "\r\n", "\t"), ' ', $entry['text']);
$query = preg_replace("/\\s{2,}/", ' ', $query);
$query = TrackerUtility::getGenericSQL($query);
$entry['text'] = $query;
$md5 = md5($query);
if (!isset($write_entries[$md5])) {
$entry['query_hash'] = $md5;
$result = $GLOBALS['db']->query("SELECT * FROM tracker_queries WHERE query_hash = '{$md5}'");
if ($row = $GLOBALS['db']->fetchByAssoc($result)) {
$entry['query_id'] = $row['query_id'];
$entry['run_count'] = $row['run_count'] + 1;
$entry['sec_total'] = $row['sec_total'] + $entry['sec_total'];
$entry['sec_avg'] = $entry['sec_total'] / $entry['run_count'];
} else {
$entry['query_id'] = create_guid();
$entry['run_count'] = 1;
$entry['sec_total'] = $entry['sec_total'];
$entry['sec_avg'] = $entry['sec_total'];
}
$write_entries[$md5] = $entry;
} else {
$write_entries[$md5]['run_count'] = $write_entries[$md5]['run_count']++;
$write_entries[$md5]['sec_total'] = $write_entries[$md5]['sec_total'] + $entry['sec_total'];
$write_entries[$md5]['sec_avg'] = $write_entries[$md5]['sec_total'] / $write_entries[$md5]['run_count'];
}
//if-else
}
//foreach
$trackerManager = TrackerManager::getInstance();
if ($monitor2 = $trackerManager->getMonitor('tracker_tracker_queries')) {
$trackerManager->pause();
//Loop through the stored cached data entries
foreach ($write_entries as $write_e) {
//Set the values from the cached data entries
foreach ($write_e as $name => $value) {
$this->{$name} = $value;
}
//foreach
//Write to the tracker_tracker_monitor monitor
$monitor2->setValue('monitor_id', $this->monitor_id);
$monitor2->setValue('date_modified', $this->date_modified);
$monitor2->setValue('query_id', $this->query_id);
$monitor2->save($flush);
// <--- save to tracker_tracker_monitor
foreach ($this->stores as $s) {
$store = $this->getStore($s);
//Flush to the store
$store->flush($this);
}
//Clear the monitor
$this->clear();
}
//foreach
$trackerManager->unPause();
}
unset($this->cached_data);
}
//if
}
示例13: endSession
function endSession()
{
$trackerManager = TrackerManager::getInstance();
if ($monitor = $trackerManager->getMonitor('tracker_sessions')) {
$monitor->setValue('date_end', TimeDate::getInstance()->nowDb());
$seconds = strtotime($monitor->date_end) - strtotime($monitor->date_start);
$monitor->setValue('seconds', $seconds);
$monitor->setValue('active', 0);
}
session_destroy();
}
示例14: display
/**
* @see SugarView::display()
*/
public function display()
{
global $sugar_config;
// Increase the max_execution_time since this step can take awhile
ini_set("max_execution_time", max($sugar_config['import_max_execution_time'], 3600));
// stop the tracker
TrackerManager::getInstance()->pause();
// use our own error handler
set_error_handler('handleImportErrors', E_ALL);
global $mod_strings, $app_strings, $current_user, $import_bean_map;
global $app_list_strings, $timedate;
$update_only = isset($_REQUEST['import_type']) && $_REQUEST['import_type'] == 'update';
$firstrow = unserialize(base64_decode($_REQUEST['firstrow']));
// All the Look Up Caches are initialized here
$enum_lookup_cache = array();
// Let's try and load the import bean
$focus = loadImportBean($_REQUEST['import_module']);
if (!$focus) {
trigger_error($mod_strings['LBL_ERROR_IMPORTS_NOT_SET_UP'], E_USER_ERROR);
}
// setup the importable fields array.
$importable_fields = $focus->get_importable_fields();
// loop through all request variables
$importColumns = array();
foreach ($_REQUEST as $name => $value) {
// only look for var names that start with "fieldNum"
if (strncasecmp($name, "colnum_", 7) != 0) {
continue;
}
// pull out the column position for this field name
$pos = substr($name, 7);
if (isset($importable_fields[$value])) {
// now mark that we've seen this field
$importColumns[$pos] = $value;
}
}
// set the default locale settings
$ifs = new ImportFieldSanitize();
$ifs->dateformat = $_REQUEST['importlocale_dateformat'];
$ifs->timeformat = $_REQUEST['importlocale_timeformat'];
$ifs->timezone = $_REQUEST['importlocale_timezone'];
$currency = new Currency();
$currency->retrieve($_REQUEST['importlocale_currency']);
$ifs->currency_symbol = $currency->symbol;
$ifs->default_currency_significant_digits = $_REQUEST['importlocale_default_currency_significant_digits'];
$ifs->num_grp_sep = $_REQUEST['importlocale_num_grp_sep'];
$ifs->dec_sep = $_REQUEST['importlocale_dec_sep'];
$ifs->default_locale_name_format = $_REQUEST['importlocale_default_locale_name_format'];
// Check to be sure we are getting an import file that is in the right place
if (realpath(dirname($_REQUEST['tmp_file']) . '/') != realpath($sugar_config['upload_dir'])) {
trigger_error($mod_strings['LBL_CANNOT_OPEN'], E_USER_ERROR);
}
// Open the import file
$importFile = new ImportFile($_REQUEST['tmp_file'], $_REQUEST['custom_delimiter'], html_entity_decode($_REQUEST['custom_enclosure'], ENT_QUOTES));
if (!$importFile->fileExists()) {
trigger_error($mod_strings['LBL_CANNOT_OPEN'], E_USER_ERROR);
}
$fieldDefs = $focus->getFieldDefinitions();
unset($focus);
while ($row = $importFile->getNextRow()) {
$focus = loadImportBean($_REQUEST['import_module']);
$focus->unPopulateDefaultValues();
$focus->save_from_post = false;
$focus->team_id = null;
$ifs->createdBeans = array();
$do_save = true;
for ($fieldNum = 0; $fieldNum < $_REQUEST['columncount']; $fieldNum++) {
// loop if this column isn't set
if (!isset($importColumns[$fieldNum])) {
continue;
}
// get this field's properties
$field = $importColumns[$fieldNum];
$fieldDef = $focus->getFieldDefinition($field);
$fieldTranslated = translate(isset($fieldDef['vname']) ? $fieldDef['vname'] : $fieldDef['name'], $_REQUEST['module']) . " (" . $fieldDef['name'] . ")";
// Bug 37241 - Don't re-import over a field we already set during the importing of another field
if (!empty($focus->{$field})) {
continue;
}
//DETERMINE WHETHER OR NOT $fieldDef['name'] IS DATE_MODIFIED AND SET A VAR, USE DOWN BELOW
// translate strings
global $locale;
if (empty($locale)) {
$locale = new Localization();
}
if (isset($row[$fieldNum])) {
$rowValue = $locale->translateCharset(strip_tags(trim($row[$fieldNum])), $_REQUEST['importlocale_charset'], $sugar_config['default_charset']);
} else {
$rowValue = '';
}
// If there is an default value then use it instead
if (!empty($_REQUEST[$field])) {
if (is_array($_REQUEST[$field])) {
$defaultRowValue = encodeMultienumValue($_REQUEST[$field]);
} else {
$defaultRowValue = $_REQUEST[$field];
}
//.........这里部分代码省略.........
示例15: 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");
}