Пример #1
0
    $input_value = trim(fgets(STDIN));
    $check_func = sprintf('check_input_for_' . $k);
    if (function_exists($check_func)) {
        $check_result = $check_func($input_value);
        if (true !== $check_result) {
            send_exit_single($check_result);
            return;
        } else {
            $db_config[$k] = $input_value ? $input_value : $v;
        }
    } else {
        $db_config[$k] = $input_value ? $input_value : $v;
    }
}
// 检测数据库链接
$pdo = check_db_connection($db_config);
if (!$pdo) {
    return;
}
// 写phinx配置
$phinx_config = file_get_contents(INSTALL_PATH . '/phinx.yml.sample');
foreach ($db_config as $k => $v) {
    $phinx_config = str_replace("%({$k})s", $v, $phinx_config);
}
file_put_contents(ENTRY_PATH . "/phinx.yml", $phinx_config);
// 同步数据表结构 及权限节点
display_loading("migrating database schema, please wait for a moment");
ob_start();
$migrate = new Install(0);
$migrate->up();
ob_end_clean();
Пример #2
0
											FROM
												sql_user
											INNER JOIN
												sql_database USING(sqld_id)
											INNER JOIN
												domain using(domain_id)
											WHERE
												sqlu_name = ?
											AND
												sqld_name = ?
											AND
												domain_admin_id = ?
										', array($appSqlUser, $appDatabase, $_SESSION['user_id']));
                                    if ($stmt->rowCount()) {
                                        $row = $stmt->fetchRow(PDO::FETCH_ASSOC);
                                        if (check_db_connection($appDatabase, $appSqlUser, $row['sqlu_pass'])) {
                                            $appSqlPassword = $row['sqlu_pass'];
                                        } else {
                                            set_page_message(tr('Unable to connect to the selected database using the selected SQL user.'), 'error');
                                            $error = true;
                                        }
                                    } else {
                                        showBadRequestErrorPage();
                                        exit;
                                    }
                                }
                            } else {
                                showBadRequestErrorPage();
                                exit;
                            }
                            $softwarePrefix = $softwareData['software_prefix'];