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


PHP Dba::check_database方法代码示例

本文整理汇总了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;
}
开发者ID:nioc,项目名称:ampache,代码行数:33,代码来源:install.lib.php

示例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 
开发者ID:bl00m,项目名称:ampache,代码行数:31,代码来源:show_test_table.inc.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];
开发者ID:cheese1,项目名称:ampache,代码行数:31,代码来源:install.php


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