本文整理匯總了PHP中rex_sql::checkDbConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP rex_sql::checkDbConnection方法的具體用法?PHP rex_sql::checkDbConnection怎麽用?PHP rex_sql::checkDbConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rex_sql
的用法示例。
在下文中一共展示了rex_sql::checkDbConnection方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkDb
/**
* Checks the version of the connected database server.
*
* @param array $config of databaes configs
* @param bool $createDb Should the database be created, if it not exists.
*
* @return string Error
*/
public static function checkDb($config, $createDb)
{
$err = rex_sql::checkDbConnection($config['db'][1]['host'], $config['db'][1]['login'], $config['db'][1]['password'], $config['db'][1]['name'], $createDb);
if ($err !== true) {
return $err;
}
$serverVersion = rex_sql::getServerVersion();
if (rex_string::versionCompare($serverVersion, self::MIN_MYSQL_VERSION, '<') == 1) {
return rex_i18n::msg('setup_404', $serverVersion, self::MIN_MYSQL_VERSION);
}
return '';
}
示例2: rex_post
$redaxo_db_create = rex_post('redaxo_db_create', 'boolean');
$cont = preg_replace("@(REX\\['SERVER'\\].?\\=.?\")[^\"]*@", '${1}' . $serveraddress, $cont);
$cont = preg_replace("@(REX\\['SERVERNAME'\\].?\\=.?\")[^\"]*@", '${1}' . $serverbezeichnung, $cont);
$cont = preg_replace("@(REX\\['LANG'\\].?\\=.?\")[^\"]*@", '${1}' . $lang, $cont);
$cont = preg_replace("@(REX\\['INSTNAME'\\].?\\=.?\")[^\"]*@", '${1}' . "rex" . date("YmdHis"), $cont);
$cont = preg_replace("@(REX\\['ERROR_EMAIL'\\].?\\=.?\")[^\"]*@", '${1}' . $error_email, $cont);
$cont = preg_replace("@(REX\\['PSWFUNC'\\].?\\=.?\")[^\"]*@", '${1}' . $psw_func, $cont);
$cont = preg_replace("@(REX\\['DB'\\]\\['1'\\]\\['HOST'\\].?\\=.?\")[^\"]*@", '${1}' . $mysql_host, $cont);
$cont = preg_replace("@(REX\\['DB'\\]\\['1'\\]\\['LOGIN'\\].?\\=.?\")[^\"]*@", '${1}' . $redaxo_db_user_login, $cont);
$cont = preg_replace("@(REX\\['DB'\\]\\['1'\\]\\['PSW'\\].?\\=.?\")[^\"]*@", '${1}' . $redaxo_db_user_pass, $cont);
$cont = preg_replace("@(REX\\['DB'\\]\\['1'\\]\\['NAME'\\].?\\=.?\")[^\"]*@", '${1}' . $dbname, $cont);
if (rex_put_file_contents($master_file, $cont) === false) {
$err_msg = $I18N->msg('setup_020', '<b>', '</b>');
}
// -------------------------- DATENBANKZUGRIFF
$err = rex_sql::checkDbConnection($mysql_host, $redaxo_db_user_login, $redaxo_db_user_pass, $dbname, $redaxo_db_create);
if ($err !== true) {
$err_msg = $err;
} else {
$REX['DB']['1']['NAME'] = $dbname;
$REX['DB']['1']['LOGIN'] = $redaxo_db_user_login;
$REX['DB']['1']['PSW'] = $redaxo_db_user_pass;
$REX['DB']['1']['HOST'] = $mysql_host;
$err_msg = "";
$checkmodus = 3;
$send = "";
}
} else {
// Allgemeine Infos
$serveraddress = $REX['SERVER'];
$serverbezeichnung = $REX['SERVERNAME'];
示例3: testCheckConnectionInvalidDatabase
public function testCheckConnectionInvalidDatabase()
{
$configFile = rex_path::data('config.yml');
$config = rex_file::getConfig($configFile);
$this->assertTrue(true !== rex_sql::checkDbConnection($config['db'][1]['host'], $config['db'][1]['login'], $config['db'][1]['password'], 'fu-database'));
}