예제 #1
0
function install_step2()
{
    check_installed();
    global $twig;
    $error = null;
    $post = array();
    if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
        $post = $_POST;
        $replace = empty($_POST['database_replace']) ? false : true;
        $error = _create_database($_POST, $replace);
        if (empty($error)) {
            $error = _create_config($_POST);
        }
        if (empty($error)) {
            header("Location: start-install.php?step=3");
            exit;
        }
    }
    echo $twig->render('step-2.html.twig', array('step' => 2, 'error' => $error, 'post' => $post));
}
예제 #2
0
function _init_auto_increment($pdo, $config)
{
    $sql = "show tables";
    $results = $pdo->query($sql)->fetchAll();
    foreach ($results as $result) {
        $table = $result["0"];
        $countSql = "select count(*) from {$table}";
        $sqlPdo = $pdo->query($countSql);
        if (!empty($sqlPdo)) {
            $count = $pdo->query($countSql)->fetchColumn(0);
            if ($count > 0) {
                $pdo->exec("alter table {$table} AUTO_INCREMENT={$count};");
            }
        }
    }
    _create_config($config);
}