diff --git a/conf/config.inc.php b/conf/config.inc.php new file mode 100644 index 0000000..04eb4d8 --- /dev/null +++ b/conf/config.inc.php @@ -0,0 +1,27 @@ +store_result(); + for ($i = 0; $i < $Statement->num_rows; $i++) { + $Metadata = $Statement->result_metadata(); + $PARAMS = array(); + while ($Field = $Metadata->fetch_field()) { + $PARAMS[] = &$RESULT[ $i ][ $Field->name ]; + } + call_user_func_array(array( $Statement, 'bind_result' ), $PARAMS); + $Statement->fetch(); + } + return $RESULT; +} diff --git a/scripts/install b/scripts/install index 2254e43..add99f3 100644 --- a/scripts/install +++ b/scripts/install @@ -114,8 +114,7 @@ ynh_mysql_connect_as $app $db_pwd $db_name < "$final_path/sql/schema.sql" # MODIFY A CONFIG FILE #================================================= -ynh_replace_string "__USER__" "$app" "$final_path/config.inc.php" -ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/config.inc.php" +ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config.inc.php" #================================================= # SETUP PERMISSIONS diff --git a/scripts/upgrade b/scripts/upgrade index b8f24e0..8795e43 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -115,8 +115,7 @@ ynh_add_fpm_config # MODIFY A CONFIG FILE #================================================= -ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="$final_path/config.inc.php" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.inc.php" +ynh_add_config --template="../conf/config.inc.php" --destination="$final_path/config.inc.php" #================================================= # RELOAD NGINX