当前位置: 首页>>代码示例>>PHP>>正文


PHP Conf::useDatabase方法代码示例

本文整理汇总了PHP中Conf::useDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP Conf::useDatabase方法的具体用法?PHP Conf::useDatabase怎么用?PHP Conf::useDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Conf的用法示例。


在下文中一共展示了Conf::useDatabase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: conf

/**
 * Load conf file (file must exists)
 *
 * @param	string		$dolibarr_main_document_root		Root directory of Dolibarr bin files
 * @return	int												<0 if KO, >0 if OK
 */
function conf($dolibarr_main_document_root) {
	global $conf, $couch;
	global $dolibarr_main_db_type;
	global $dolibarr_main_db_host;
	global $dolibarr_main_db_port;
	global $dolibarr_main_db_name;
	global $dolibarr_main_db_user;
	global $dolibarr_main_db_pass;
	global $character_set_client;

	global $dolibarr_main_couchdb_host;
	global $dolibarr_main_couchdb_port;
	global $dolibarr_main_couchdb_name;

	$return = include_once($dolibarr_main_document_root . "/core/class/conf.class.php");
	if (!$return)
		return -1;

	$conf = new Conf();
	$conf->db->type = trim($dolibarr_main_db_type);
	$conf->db->host = trim($dolibarr_main_db_host);
	$conf->db->port = trim($dolibarr_main_db_port);
	$conf->db->name = trim($dolibarr_main_db_name);
	$conf->db->user = trim($dolibarr_main_db_user);
	$conf->db->pass = trim($dolibarr_main_db_pass);

	// CouchDB
	$conf->Couchdb->host = trim($dolibarr_main_couchdb_host);
	$conf->Couchdb->port = trim($dolibarr_main_couchdb_port);
	$conf->Couchdb->name = trim($dolibarr_main_couchdb_name);
	
	$couch = new couchClient($conf->Couchdb->host . ':' . $conf->Couchdb->port . '/', $conf->Couchdb->name);
	$couch->setSessionCookie("AuthSession=" . $_COOKIE['AuthSession']);

	$conf->useDatabase();

	if (empty($character_set_client))
		$character_set_client = "UTF-8";
	$conf->file->character_set_client = strtoupper($character_set_client);
	if (empty($dolibarr_main_db_character_set))
		$dolibarr_main_db_character_set = ($conf->db->type == 'mysql' ? 'latin1' : '');  // Old installation
	$conf->db->character_set = $dolibarr_main_db_character_set;
	if (empty($dolibarr_main_db_collation))
		$dolibarr_main_db_collation = ($conf->db->type == 'mysql' ? 'latin1_swedish_ci' : '');  // Old installation
	$conf->db->dolibarr_main_db_collation = $dolibarr_main_db_collation;
	if (empty($dolibarr_main_db_encryption))
		$dolibarr_main_db_encryption = 0;
	$conf->db->dolibarr_main_db_encryption = $dolibarr_main_db_encryption;
	if (empty($dolibarr_main_db_cryptkey))
		$dolibarr_main_db_cryptkey = '';
	$conf->db->dolibarr_main_db_cryptkey = $dolibarr_main_db_cryptkey;

	// Force usage of log file for install and upgrades
	$conf->syslog->enabled = 1;
	$conf->global->SYSLOG_LEVEL = constant('LOG_DEBUG');
	if (!defined('SYSLOG_FILE_ON'))
		define('SYSLOG_FILE_ON', 1);
	if (!defined('SYSLOG_FILE')) { // To avoid warning on systems with constant already defined
		if (@is_writable('/tmp'))
			define('SYSLOG_FILE', '/tmp/dolibarr_install.log');
		else if (!empty($_ENV["TMP"]) && @is_writable($_ENV["TMP"]))
			define('SYSLOG_FILE', $_ENV["TMP"] . '/dolibarr_install.log');
		else if (!empty($_ENV["TEMP"]) && @is_writable($_ENV["TEMP"]))
			define('SYSLOG_FILE', $_ENV["TEMP"] . '/dolibarr_install.log');
		else if (@is_writable('../../../../') && @file_exists('../../../../startdoliwamp.bat'))
			define('SYSLOG_FILE', '../../../../dolibarr_install.log'); // For DoliWamp
		else if (@is_writable('../../'))
			define('SYSLOG_FILE', '../../dolibarr_install.log');	// For others
			
//print 'SYSLOG_FILE='.SYSLOG_FILE;exit;
	}
	if (!defined('SYSLOG_FILE_NO_ERROR'))
		define('SYSLOG_FILE_NO_ERROR', 1);

	return 1;
}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:82,代码来源:inc.php


注:本文中的Conf::useDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。