本文整理汇总了PHP中Dba::check_database方法的典型用法代码示例。如果您正苦于以下问题:PHP Dba::check_database方法的具体用法?PHP Dba::check_database怎么用?PHP Dba::check_database使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dba
的用法示例。
在下文中一共展示了Dba::check_database方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: install_create_account
/**
* install_create_account
* this creates your initial account and sets up the preferences for the -1 user and you
*/
function install_create_account($username, $password, $password2)
{
if (!strlen($username) or !strlen($password)) {
Error::add('general', T_('No Username/Password specified'));
return false;
}
if ($password !== $password2) {
Error::add('general', T_('Passwords do not match'));
return false;
}
if (!Dba::check_database()) {
Error::add('general', sprintf(T_('Database connection failed: %s'), Dba::error()));
return false;
}
if (!Dba::check_database_inserted()) {
Error::add('general', sprintf(T_('Database select failed: %s'), Dba::error()));
return false;
}
$username = Dba::escape($username);
$password = Dba::escape($password);
$insert_id = User::create($username, 'Administrator', '', '', $password, '100');
if (!$insert_id) {
Error::add('general', sprintf(T_('Administrative user creation failed: %s'), Dba::error()));
return false;
}
// Fix the system users preferences
User::fix_preferences('-1');
return true;
}
示例2: T_
?>
</td>
<td>
<?php
echo T_("This test makes sure that you have set all of the required configuration variables and that we are able to completely parse your config file.");
?>
</td>
</tr>
<tr>
<td valign="top"><?php
echo T_("Database connection");
?>
</td>
<td valign="top">
<?php
echo debug_result(check_php_pdo() && Dba::check_database());
?>
</td>
<td>
<?php
echo T_('This attempts to connect to your database using the values read from your configuration file.');
?>
</td>
</tr>
<tr>
<td valign="top"><?php
echo T_('Database tables');
?>
</td>
<td valign="top">
<?php
示例3: install_config_transcode_mode
if (!$skip_admin) {
AmpConfig::set_by_array(array('database_username' => $username, 'database_password' => $password), true);
}
if (isset($_REQUEST['transcode_template'])) {
$mode = $_REQUEST['transcode_template'];
install_config_transcode_mode($mode);
}
if (isset($_REQUEST['usecase'])) {
$case = $_REQUEST['usecase'];
if (Dba::check_database()) {
install_config_use_case($case);
}
}
if (isset($_REQUEST['backends'])) {
$backends = $_REQUEST['backends'];
if (Dba::check_database()) {
install_config_backends($backends);
}
}
// Charset and gettext setup
$htmllang = $_REQUEST['htmllang'];
$charset = $_REQUEST['charset'];
if (!$htmllang) {
if ($_ENV['LANG']) {
$lang = $_ENV['LANG'];
} else {
$lang = 'en_US';
}
if (strpos($lang, '.')) {
$langtmp = explode('.', $lang);
$htmllang = $langtmp[0];