コード例 #1
0
function import_sql_scripts_to_databases($schema_files, $db_ids, $psa_modify_hash, $db_modify_hash, $settings_modify_hash, $crypt_settings_modify_hash, $settings_enum_modify_hash, $additional_modify_hash)
{
    foreach ($db_ids as $db_id) {
        if (get_db_type($db_id) != "mysql") {
            print "FIXME: database type " . get_db_type($db_id) . " is not supported.\n";
            exit(1);
        }
        foreach ($schema_files as $schema_filename => $schema_db_id) {
            if ($schema_db_id == $db_id) {
                mysql_db_connect(get_db_address($db_id), get_db_login($db_id), get_db_password($db_id), get_db_name($db_id));
                $sql = modify_content($schema_filename, array_merge($psa_modify_hash, $db_modify_hash, $settings_modify_hash, $settings_enum_modify_hash, $crypt_settings_modify_hash, $additional_modify_hash));
                populate_mysql_db($sql);
            }
        }
    }
}
コード例 #2
0
function get_db_modify_hash($db_ids)
{
    $parameters = array();
    foreach ($db_ids as $db_id) {
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_TYPE" . "@@"] = get_db_type($db_id);
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_NAME" . "@@"] = get_db_name($db_id);
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_LOGIN" . "@@"] = get_db_login($db_id);
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_PASSWORD" . "@@"] = get_db_password($db_id);
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_HOST" . "@@"] = fetch_env_var("DB_{$db_id}_HOST");
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_VERSION" . "@@"] = fetch_env_var("DB_{$db_id}_VERSION");
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_PORT" . "@@"] = fetch_env_var("DB_{$db_id}_PORT");
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_PREFIX" . "@@"] = get_db_prefix($db_id);
        $parameters["@@" . "DB_" . strtoupper($db_id) . "_ADDRESS" . "@@"] = get_db_address($db_id);
    }
    return $parameters;
}