本文整理汇总了PHP中DBManagerFactory::getManagerByType方法的典型用法代码示例。如果您正苦于以下问题:PHP DBManagerFactory::getManagerByType方法的具体用法?PHP DBManagerFactory::getManagerByType怎么用?PHP DBManagerFactory::getManagerByType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManagerFactory
的用法示例。
在下文中一共展示了DBManagerFactory::getManagerByType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleSugarConfig
/**
* takes session vars and creates config.php
* @return array bottle collection of error messages
*/
function handleSugarConfig()
{
global $bottle;
global $cache_dir;
global $mod_strings;
global $setup_db_host_name;
global $setup_db_host_instance;
global $setup_db_port_num;
global $setup_db_sugarsales_user;
global $setup_db_sugarsales_password;
global $setup_db_database_name;
global $setup_site_host_name;
global $setup_site_log_dir;
global $setup_site_log_file;
global $setup_site_session_path;
global $setup_site_guid;
global $setup_site_url;
global $setup_sugar_version;
global $sugar_config;
global $setup_site_log_level;
echo "<b>{$mod_strings['LBL_PERFORM_CONFIG_PHP']} (config.php)</b><br>";
///////////////////////////////////////////////////////////////////////////////
//// $sugar_config SETTINGS
if (is_file('config.php')) {
$is_writable = is_writable('config.php');
// require is needed here (config.php is sometimes require'd from install.php)
require 'config.php';
} else {
$is_writable = is_writable('.');
}
// build default sugar_config and merge with new values
$sugar_config = sugarArrayMerge(get_sugar_config_defaults(), $sugar_config);
// always lock the installer
$sugar_config['installer_locked'] = true;
// we're setting these since the user was given a fair chance to change them
$sugar_config['dbconfig']['db_host_name'] = $setup_db_host_name;
if (!empty($setup_db_host_instance)) {
$sugar_config['dbconfig']['db_host_instance'] = $setup_db_host_instance;
} else {
$sugar_config['dbconfig']['db_host_instance'] = '';
}
if (!isset($_SESSION['setup_db_manager'])) {
$_SESSION['setup_db_manager'] = DBManagerFactory::getManagerByType($_SESSION['setup_db_type']);
}
$sugar_config['dbconfig']['db_user_name'] = $setup_db_sugarsales_user;
$sugar_config['dbconfig']['db_password'] = $setup_db_sugarsales_password;
$sugar_config['dbconfig']['db_name'] = $setup_db_database_name;
$sugar_config['dbconfig']['db_type'] = $_SESSION['setup_db_type'];
$sugar_config['dbconfig']['db_port'] = $setup_db_port_num;
$sugar_config['dbconfig']['db_manager'] = $_SESSION['setup_db_manager'];
if (!empty($_SESSION['setup_db_options'])) {
$sugar_config['dbconfigoption'] = array_merge($sugar_config['dbconfigoption'], $_SESSION['setup_db_options']);
}
$sugar_config['cache_dir'] = $cache_dir;
$sugar_config['default_charset'] = $mod_strings['DEFAULT_CHARSET'];
$sugar_config['default_email_client'] = 'sugar';
$sugar_config['default_email_editor'] = 'html';
$sugar_config['host_name'] = $setup_site_host_name;
$sugar_config['js_custom_version'] = '';
$sugar_config['use_real_names'] = true;
$sugar_config['disable_convert_lead'] = false;
$sugar_config['log_dir'] = $setup_site_log_dir;
$sugar_config['log_file'] = $setup_site_log_file;
//Setup FTS
if (!empty($_SESSION['fts_type'])) {
$sugar_config['full_text_engine'] = array($_SESSION['fts_type'] => array('host' => $_SESSION['fts_host'], 'port' => $_SESSION['fts_port']));
}
// for silent install
if (!empty($_SESSION['setup_fts_type'])) {
$sugar_config['full_text_engine'] = array($_SESSION['setup_fts_type'] => array('host' => $_SESSION['setup_fts_host'], 'port' => $_SESSION['setup_fts_port']));
if (isset($_SESSION['setup_fts_hide_config'])) {
$sugar_config['hide_full_text_engine_config'] = $_SESSION['setup_fts_hide_config'];
}
}
/*nsingh(bug 22402): Consolidate logger settings under $config['logger'] as liked by the new logger! If log4pphp exists,
these settings will be overwritten by those in log4php.properties when the user access admin->system settings.*/
$sugar_config['logger'] = array('level' => $setup_site_log_level, 'file' => array('ext' => '.log', 'name' => 'sugarcrm', 'dateFormat' => '%c', 'maxSize' => '10MB', 'maxLogs' => 10, 'suffix' => ''));
$sugar_config['session_dir'] = $setup_site_session_path;
$sugar_config['site_url'] = $setup_site_url;
$sugar_config['sugar_version'] = $setup_sugar_version;
$sugar_config['tmp_dir'] = $cache_dir . 'xml/';
$sugar_config['upload_dir'] = 'upload/';
// $sugar_config['use_php_code_json'] = returnPhpJsonStatus(); // true on error
if (isset($_SESSION['setup_site_sugarbeet_anonymous_stats'])) {
$sugar_config['sugarbeet'] = $_SESSION['setup_site_sugarbeet_anonymous_stats'];
}
$sugar_config['demoData'] = $_SESSION['demoData'];
if (isset($setup_site_guid)) {
$sugar_config['unique_key'] = $setup_site_guid;
}
if (empty($sugar_config['unique_key'])) {
$sugar_config['unique_key'] = md5(create_guid());
}
// add installed langs to config
// entry in upgrade_history comes AFTER table creation
if (isset($_SESSION['INSTALLED_LANG_PACKS']) && is_array($_SESSION['INSTALLED_LANG_PACKS']) && !empty($_SESSION['INSTALLED_LANG_PACKS'])) {
//.........这里部分代码省略.........
示例2: copyInputsIntoSession
function copyInputsIntoSession()
{
if (isset($_REQUEST['setup_db_type'])) {
$_SESSION['setup_db_type'] = $_REQUEST['setup_db_type'];
}
if (isset($_REQUEST['setup_db_admin_user_name'])) {
$_SESSION['setup_db_admin_user_name'] = $_REQUEST['setup_db_admin_user_name'];
}
if (isset($_REQUEST['setup_db_admin_password'])) {
$_SESSION['setup_db_admin_password'] = $_REQUEST['setup_db_admin_password'];
}
if (isset($_REQUEST['setup_db_database_name'])) {
$_SESSION['setup_db_database_name'] = $_REQUEST['setup_db_database_name'];
}
if (isset($_REQUEST['setup_db_host_name'])) {
$_SESSION['setup_db_host_name'] = $_REQUEST['setup_db_host_name'];
}
//FTS Support
$_SESSION['fts_type'] = isset($_REQUEST['fts_type']) ? $_REQUEST['fts_type'] : "";
if (isset($_REQUEST['fts_host'])) {
$_SESSION['fts_host'] = $_REQUEST['fts_host'];
}
if (isset($_REQUEST['fts_port'])) {
$_SESSION['fts_port'] = $_REQUEST['fts_port'];
}
if (isset($_SESSION['setup_db_type']) && (!isset($_SESSION['setup_db_manager']) || isset($_REQUEST['setup_db_type']))) {
$_SESSION['setup_db_manager'] = DBManagerFactory::getManagerByType($_SESSION['setup_db_type']);
}
if (isset($_REQUEST['setup_db_host_instance'])) {
$_SESSION['setup_db_host_instance'] = $_REQUEST['setup_db_host_instance'];
}
if (isset($_REQUEST['setup_db_port_num'])) {
$_SESSION['setup_db_port_num'] = $_REQUEST['setup_db_port_num'];
}
// on a silent install, copy values from $_SESSION into $_REQUEST
if (isset($_REQUEST['goto']) && $_REQUEST['goto'] == 'SilentInstall') {
if (isset($_SESSION['dbUSRData']) && !empty($_SESSION['dbUSRData'])) {
$_REQUEST['dbUSRData'] = $_SESSION['dbUSRData'];
} else {
$_REQUEST['dbUSRData'] = 'same';
}
if (isset($_SESSION['setup_db_sugarsales_user']) && !empty($_SESSION['setup_db_sugarsales_user'])) {
$_REQUEST['setup_db_sugarsales_user'] = $_SESSION['setup_db_sugarsales_user'];
} else {
$_REQUEST['dbUSRData'] = 'same';
}
$_REQUEST['setup_db_sugarsales_password'] = $_SESSION['setup_db_sugarsales_password'];
$_REQUEST['setup_db_sugarsales_password_retype'] = $_SESSION['setup_db_sugarsales_password'];
}
//make sure we are creating or using provided user for app db connections
$_SESSION['setup_db_create_sugarsales_user'] = true;
//get_boolean_from_request('setup_db_create_sugarsales_user');
$db = getInstallDbInstance();
if (!$db->supports("create_user")) {
//if the DB doesn't support creating users, make the admin user/password same as connecting user/password
$_SESSION['setup_db_sugarsales_user'] = $_SESSION['setup_db_admin_user_name'];
$_SESSION['setup_db_sugarsales_password'] = $_SESSION['setup_db_admin_password'];
$_SESSION['setup_db_sugarsales_password_retype'] = $_SESSION['setup_db_sugarsales_password'];
$_SESSION['setup_db_create_sugarsales_user'] = false;
$_SESSION['setup_db_create_database'] = false;
} else {
$_SESSION['setup_db_create_database'] = true;
//retrieve the value from dropdown in order to know what settings the user
//wants to use for the sugar db user.
//use provided db admin by default
$_SESSION['dbUSRData'] = 'same';
if (isset($_REQUEST['dbUSRData']) && !empty($_REQUEST['dbUSRData'])) {
$_SESSION['dbUSRData'] = $_REQUEST['dbUSRData'];
}
if ($_SESSION['dbUSRData'] == 'auto') {
//create user automatically
$_SESSION['setup_db_create_sugarsales_user'] = true;
$_SESSION['setup_db_sugarsales_user'] = "sugar" . create_db_user_creds(5);
$_SESSION['setup_db_sugarsales_password'] = create_db_user_creds(10);
$_SESSION['setup_db_sugarsales_password_retype'] = $_SESSION['setup_db_sugarsales_password'];
} elseif ($_SESSION['dbUSRData'] == 'provide') {
//use provided user info
$_SESSION['setup_db_create_sugarsales_user'] = false;
$_SESSION['setup_db_sugarsales_user'] = $_REQUEST['setup_db_sugarsales_user'];
$_SESSION['setup_db_sugarsales_password'] = $_REQUEST['setup_db_sugarsales_password'];
$_SESSION['setup_db_sugarsales_password_retype'] = $_REQUEST['setup_db_sugarsales_password_retype'];
} elseif ($_SESSION['dbUSRData'] == 'create') {
// create user with provided info
$_SESSION['setup_db_create_sugarsales_user'] = true;
$_SESSION['setup_db_sugarsales_user'] = $_REQUEST['setup_db_sugarsales_user'];
$_SESSION['setup_db_sugarsales_password'] = $_REQUEST['setup_db_sugarsales_password'];
$_SESSION['setup_db_sugarsales_password_retype'] = $_REQUEST['setup_db_sugarsales_password_retype'];
} else {
//Use the same login as provided admin user
$_SESSION['setup_db_create_sugarsales_user'] = false;
$_SESSION['setup_db_sugarsales_user'] = $_SESSION['setup_db_admin_user_name'];
$_SESSION['setup_db_sugarsales_password'] = $_SESSION['setup_db_admin_password'];
$_SESSION['setup_db_sugarsales_retype'] = $_SESSION['setup_db_admin_password'];
}
}
if (!isset($_SESSION['demoData']) || empty($_SESSION['demoData'])) {
$_SESSION['demoData'] = 'no';
}
if (isset($_REQUEST['demoData'])) {
$_SESSION['demoData'] = $_REQUEST['demoData'];
//.........这里部分代码省略.........