本文整理汇总了PHP中SugarConfig::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarConfig::getInstance方法的具体用法?PHP SugarConfig::getInstance怎么用?PHP SugarConfig::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarConfig
的用法示例。
在下文中一共展示了SugarConfig::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
private function __construct()
{
$level = SugarConfig::getInstance()->get('logger.level', $this->level);
if (!empty($level)) {
$this->setLevel($level);
}
}
示例2: handleOverride
function handleOverride()
{
global $sugar_config, $sugar_version;
$sc = SugarConfig::getInstance();
$overrideArray = $this->readOverride();
$this->previous_sugar_override_config_array = $overrideArray;
$diffArray = deepArrayDiff($this->config, $sugar_config);
$overrideArray = sugarArrayMerge($overrideArray, $diffArray);
$overideString = "<?php\n/***CONFIGURATOR***/\n";
sugar_cache_put('sugar_config', $this->config);
$GLOBALS['sugar_config'] = $this->config;
foreach ($overrideArray as $key => $val) {
if (in_array($key, $this->allow_undefined) || isset($sugar_config[$key])) {
if (strcmp("{$val}", 'true') == 0) {
$val = true;
$this->config[$key] = $val;
}
if (strcmp("{$val}", 'false') == 0) {
$val = false;
$this->config[$key] = false;
}
}
$overideString .= override_value_to_string_recursive2('sugar_config', $key, $val);
}
$overideString .= '/***CONFIGURATOR***/';
$this->saveOverride($overideString);
if (isset($this->config['logger']['level']) && $this->logger) {
$this->logger->setLevel($this->config['logger']['level']);
}
}
示例3: run
public function run()
{
$config = SugarConfig::getInstance();
foreach ($this->upgradeLabels as $module => $labels) {
$changedLanguages = array();
// Let's fix labels for all languages
foreach ($config->get('languages') as $key => $value) {
if ($this->upgradeModuleLabels($module, $key)) {
$changedLanguages[$key] = $key;
}
}
// Rebuild changed languages for module
if (!empty($changedLanguages)) {
$this->rebuildLanguages($changedLanguages, $module);
}
$changedSubpanels = array();
// Fix subpanels
if ($this->upgradeSubpanelModuleLabels($module)) {
$changedSubpanels[$key] = $key;
}
$changedListViews = array();
// Fix list views
if ($this->upgradeListViewModuleLabels($module)) {
$changedListViews[$key] = $key;
}
}
}
示例4: display
/**
* @see SugarView::display()
*/
public function display()
{
global $current_user, $mod_strings, $app_strings, $app_list_strings, $sugar_config, $locale;
$configurator = new Configurator();
$sugarConfig = SugarConfig::getInstance();
$focus = new Administration();
$configurator->parseLoggerSettings();
$focus->retrieveSettings();
if (!empty($_POST['restore'])) {
$configurator->restoreConfig();
}
$this->ss->assign('MOD', $mod_strings);
$this->ss->assign('APP', $app_strings);
$this->ss->assign('APP_LIST', $app_list_strings);
$this->ss->assign('config', $configurator->config);
$this->ss->assign('error', $configurator->errors);
$this->ss->assign("AUTO_REFRESH_INTERVAL_OPTIONS", get_select_options_with_id($app_list_strings['dashlet_auto_refresh_options_admin'], isset($configurator->config['dashlet_auto_refresh_min']) ? $configurator->config['dashlet_auto_refresh_min'] : 30));
$this->ss->assign('LANGUAGES', get_languages());
$this->ss->assign("JAVASCRIPT", get_set_focus_js() . get_configsettings_js());
$this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
$this->ss->assign("settings", $focus->settings);
$this->ss->assign("mail_sendtype_options", get_select_options_with_id($app_list_strings['notifymail_sendtype'], $focus->settings['mail_sendtype']));
if (!empty($focus->settings['proxy_on'])) {
$this->ss->assign("PROXY_CONFIG_DISPLAY", 'inline');
} else {
$this->ss->assign("PROXY_CONFIG_DISPLAY", 'none');
}
if (!empty($focus->settings['proxy_auth'])) {
$this->ss->assign("PROXY_AUTH_DISPLAY", 'inline');
} else {
$this->ss->assign("PROXY_AUTH_DISPLAY", 'none');
}
if (!empty($configurator->config['logger']['level'])) {
$this->ss->assign('log_levels', get_select_options_with_id(LoggerManager::getLoggerLevels(), $configurator->config['logger']['level']));
} else {
$this->ss->assign('log_levels', get_select_options_with_id(LoggerManager::getLoggerLevels(), ''));
}
if (!empty($configurator->config['lead_conv_activity_opt'])) {
$this->ss->assign('lead_conv_activities', get_select_options_with_id(Lead::getActivitiesOptions(), $configurator->config['lead_conv_activity_opt']));
} else {
$this->ss->assign('lead_conv_activities', get_select_options_with_id(Lead::getActivitiesOptions(), ''));
}
if (!empty($configurator->config['logger']['file']['suffix'])) {
$this->ss->assign('filename_suffix', get_select_options_with_id(SugarLogger::$filename_suffix, $configurator->config['logger']['file']['suffix']));
} else {
$this->ss->assign('filename_suffix', get_select_options_with_id(SugarLogger::$filename_suffix, ''));
}
echo $this->getModuleTitle(false);
$this->ss->display('modules/Configurator/tpls/EditView.tpl');
$javascript = new javascript();
$javascript->setFormName("ConfigureSettings");
$javascript->addFieldGeneric("notify_fromaddress", "email", $mod_strings['LBL_NOTIFY_FROMADDRESS'], TRUE, "");
$javascript->addFieldGeneric("notify_subject", "varchar", $mod_strings['LBL_NOTIFY_SUBJECT'], TRUE, "");
$javascript->addFieldGeneric("proxy_host", "varchar", $mod_strings['LBL_PROXY_HOST'], TRUE, "");
$javascript->addFieldGeneric("proxy_port", "int", $mod_strings['LBL_PROXY_PORT'], TRUE, "");
$javascript->addFieldGeneric("proxy_password", "varchar", $mod_strings['LBL_PROXY_PASSWORD'], TRUE, "");
$javascript->addFieldGeneric("proxy_username", "varchar", $mod_strings['LBL_PROXY_USERNAME'], TRUE, "");
echo $javascript->getScript();
}
示例5: tearDown
public function tearDown()
{
if (file_exists($this->_filename)) {
unlink($this->_filename);
}
$GLOBALS['sugar_config']['default_permissions'] = $this->_old_default_permissions;
SugarConfig::getInstance()->clearCache();
}
示例6: logDebug
public function logDebug($message)
{
$defaultLogLevel = 'fatal';
$config = SugarConfig::getInstance();
$level = $config->get('logger.level', $defaultLogLevel);
if ($level == 'debug') {
$this->log($message);
}
}
示例7: __construct
/**
* Ctor
* @param string $version
*/
public function __construct($version, LoggerTransition $logger = null)
{
$this->localInstall = $version != "GLOBAL" && $version != "PROJECT";
if ($this->localInstall) {
$this->logger = new LoggerTransition(\LoggerManager::getLogger());
$this->config = \SugarConfig::getInstance();
}
parent::__construct('sugar-cli', $version);
}
示例8: __construct
private function __construct()
{
$level = SugarConfig::getInstance()->get('logger.level', $this->_level);
if (!empty($level)) {
$this->setLevel($level);
}
if (empty(self::$_loggers)) {
$this->_findAvailableLoggers();
}
}
示例9: display
/**
* @see SugarView::display()
*/
public function display()
{
global $current_user, $mod_strings, $app_list_strings, $sugar_config, $locale, $sugar_version;
if (!is_admin($current_user)) {
sugar_die($GLOBALS['app_strings']['ERR_NOT_ADMIN']);
}
$themeObject = SugarThemeRegistry::current();
$configurator = new Configurator();
$sugarConfig = SugarConfig::getInstance();
$focus = new Administration();
$focus->retrieveSettings();
$ut = $GLOBALS['current_user']->getPreference('ut');
if (empty($ut)) {
$this->ss->assign('SKIP_URL', 'index.php?module=Users&action=Wizard&skipwelcome=1');
} else {
$this->ss->assign('SKIP_URL', 'index.php?module=Home&action=index');
}
// Always mark that we have got past this point
$focus->saveSetting('system', 'adminwizard', 1);
$css = $themeObject->getCSS();
$favicon = $themeObject->getImageURL('sugar_icon.ico', false);
$this->ss->assign('FAVICON_URL', getJSPath($favicon));
$this->ss->assign('SUGAR_CSS', $css);
$this->ss->assign('MOD_USERS', return_module_language($GLOBALS['current_language'], 'Users'));
$this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="' . SugarThemeRegistry::current()->getCSSURL('wizard.css') . '" />');
$this->ss->assign('LANGUAGES', get_languages());
$this->ss->assign('config', $sugar_config);
$this->ss->assign('SUGAR_VERSION', $sugar_version);
$this->ss->assign('settings', $focus->settings);
$this->ss->assign('exportCharsets', get_select_options_with_id($locale->getCharsetSelect(), $sugar_config['default_export_charset']));
$this->ss->assign('getNameJs', $locale->getNameJs());
$this->ss->assign('NAMEFORMATS', $locale->getUsableLocaleNameOptions($sugar_config['name_formats']));
$this->ss->assign('JAVASCRIPT', get_set_focus_js() . get_configsettings_js());
$this->ss->assign('company_logo', SugarThemeRegistry::current()->getImageURL('company_logo.png'));
$this->ss->assign('mail_smtptype', $focus->settings['mail_smtptype']);
$this->ss->assign('mail_smtpserver', $focus->settings['mail_smtpserver']);
$this->ss->assign('mail_smtpport', $focus->settings['mail_smtpport']);
$this->ss->assign('mail_smtpuser', $focus->settings['mail_smtpuser']);
$this->ss->assign('mail_smtppass', $focus->settings['mail_smtppass']);
$this->ss->assign('mail_smtpauth_req', $focus->settings['mail_smtpauth_req'] ? "checked='checked'" : '');
$this->ss->assign('MAIL_SSL_OPTIONS', get_select_options_with_id($app_list_strings['email_settings_for_ssl'], $focus->settings['mail_smtpssl']));
$this->ss->assign('notify_allow_default_outbound_on', !empty($focus->settings['notify_allow_default_outbound']) && $focus->settings['notify_allow_default_outbound'] == 2 ? 'CHECKED' : '');
$this->ss->assign('THEME', SugarThemeRegistry::current()->__toString());
// get javascript
ob_start();
$this->options['show_javascript'] = true;
$this->renderJavascript();
$this->options['show_javascript'] = false;
$this->ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
ob_end_clean();
$this->ss->assign('langHeader', get_language_header());
$this->ss->assign('START_PAGE', !empty($_REQUEST['page']) ? $_REQUEST['page'] : 'welcome');
$this->ss->display('modules/Configurator/tpls/adminwizard.tpl');
}
示例10: _getMemcachedObject
/**
* Get the memcached object; initialize if needed
*/
protected function _getMemcachedObject()
{
if (!$this->_memcached instanceof Memcached) {
$this->_memcached = new Memcached();
$this->_host = SugarConfig::getInstance()->get('external_cache.memcache.host', $this->_host);
$this->_port = SugarConfig::getInstance()->get('external_cache.memcache.port', $this->_port);
if (!@$this->_memcached->addServer($this->_host, $this->_port)) {
return false;
}
}
return $this->_memcached;
}
示例11: __construct
function __construct()
{
$config = SugarConfig::getInstance();
$this->ext = $config->get('logger.file.ext', $this->ext);
$this->logfile = $config->get('logger.file.name', $this->logfile);
$this->dateFormat = $config->get('logger.file.dateFormat', $this->dateFormat);
$this->logSize = $config->get('logger.file.maxSize', $this->logSize);
$this->maxLogs = $config->get('logger.file.maxLogs', $this->maxLogs);
$this->filesuffix = $config->get('logger.file.suffix', $this->filesuffix);
unset($config);
$this->doInitialization();
}
示例12: testAssertLogging
public function testAssertLogging()
{
$GLOBALS['log']->setLevel('debug');
$GLOBALS['log']->assert('this was asserted true', true);
$GLOBALS['log']->assert('this was asserted false', false);
$config = SugarConfig::getInstance();
$ext = $config->get('logger.file.ext');
$logfile = $config->get('logger.file.name');
$log_dir = $config->get('log_dir');
$log_dir = $log_dir . (empty($log_dir) ? '' : '/');
$logFile = file_get_contents($log_dir . $logfile . $ext);
$this->assertContains('[DEBUG] this was asserted false', $logFile);
$this->assertNotContains('[DEBUG] this was asserted true', $logFile);
}
示例13: __construct
public function __construct()
{
$config = SugarConfig::getInstance();
$this->ext = '.log';
$this->logfile = 'PMSE';
$this->dateFormat = $config->get('logger.file.dateFormat', $this->dateFormat);
$this->logSize = $config->get('logger.file.maxSize', $this->logSize);
$this->maxLogs = $config->get('logger.file.maxLogs', $this->maxLogs);
$this->filesuffix = $config->get('logger.file.suffix', $this->filesuffix);
$log_dir = $config->get('log_dir', $this->log_dir);
$this->log_dir = $log_dir . (empty($log_dir) ? '' : '/');
unset($config);
$this->_doInitialization();
}
示例14: __construct
/**
* @param SugarSearchEngineAqbstractBase $engine
*/
public function __construct(SugarSearchEngineAbstractBase $engine = null)
{
if ($engine != null) {
$this->SSEngine = $engine;
} else {
$this->SSEngine = SugarSearchEngineFactory::getInstance();
}
$this->db = DBManagerFactory::getInstance('fts');
$this->table_name = self::QUEUE_TABLE;
$config = SugarConfig::getInstance();
$this->max_bulk_threshold = $config->get('search_engine.max_bulk_threshold', $this->max_bulk_threshold);
$this->max_bulk_query_threshold = $config->get('search_engine.max_bulk_query_threshold', $this->max_bulk_query_threshold);
$this->max_bulk_delete_threshold = $config->get('search_engine.max_bulk_delete_threshold', $this->max_bulk_delete_threshold);
$this->postpone_job_time = $config->get('search_engine.postpone_job_time', $this->postpone_job_time);
}
示例15: __construct
/**
* Constructor
*
* Reads the config file for logger settings
*/
public function __construct()
{
$config = SugarConfig::getInstance();
$this->ext = $config->get('logger.file.ext', $this->ext);
$this->logfile = $config->get('logger.file.name', $this->logfile);
$this->dateFormat = $config->get('logger.file.dateFormat', $this->dateFormat);
$this->logSize = $config->get('logger.file.maxSize', $this->logSize);
$this->maxLogs = $config->get('logger.file.maxLogs', $this->maxLogs);
$this->filesuffix = $config->get('logger.file.suffix', $this->filesuffix);
$log_dir = $config->get('log_dir', $this->log_dir);
$this->log_dir = $log_dir . (empty($log_dir) ? '' : '/');
unset($config);
$this->_doInitialization();
LoggerManager::setLogger('default', 'SugarLogger');
}