mirror of
https://github.com/YunoHost-Apps/galette_ynh.git
synced 2024-09-03 18:36:28 +02:00
pgsql
This commit is contained in:
parent
10dd878877
commit
b900c4838a
7 changed files with 57 additions and 41 deletions
|
@ -1,25 +1,41 @@
|
|||
<?php
|
||||
/*
|
||||
This is an example for your configuration file,
|
||||
read comments and replace the "blanks".
|
||||
You can then copy the file in GALETTE_CONFIG_PATH/config.inc.php
|
||||
|
||||
$Id$
|
||||
*/
|
||||
/**
|
||||
* PostgreSQL configuration file for tests
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category Tests
|
||||
* @package Galette
|
||||
*
|
||||
* @author Johan Cwiklinski <johan@x-tnd.be>
|
||||
* @copyright 2012-2014 The Galette Team
|
||||
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
|
||||
* @version SVN: $Id$
|
||||
* @link http://galette.tuxfamily.org
|
||||
* @since Available since 0.7.3dev 2012-12-12
|
||||
*/
|
||||
|
||||
/* choose your database engine, values : pgsql|mysql */
|
||||
define("TYPE_DB", "mysql");
|
||||
/* hostname for the database */
|
||||
define("HOST_DB", "localhost");
|
||||
/* tcp port for the database */
|
||||
define("PORT_DB", "3306");
|
||||
/* the username for the database */
|
||||
define("USER_DB", "__DB_NAME__");
|
||||
/* password for the username define above */
|
||||
define("PWD_DB", "__DB_PWD__");
|
||||
/* the database name */
|
||||
define("NAME_DB", "__DB_NAME__");
|
||||
/* tables name prefix (default is galette_) */
|
||||
define("PREFIX_DB", "galette_");
|
||||
/* FIXME will disappear soon */
|
||||
define("STOCK_FILES", "tempimages");
|
||||
define("TYPE_DB", "pgsql");
|
||||
|
||||
if (file_exists(__DIR__ . '/local_config.inc.php')) {
|
||||
include_once __DIR__ . '/local_config.inc.php';
|
||||
}
|
||||
if (!defined('HOST_DB')) {
|
||||
define("HOST_DB", "localhost");
|
||||
}
|
||||
if (!defined('PORT_DB')) {
|
||||
define("PORT_DB", "5432");
|
||||
}
|
||||
if (!defined('USER_DB')) {
|
||||
define("USER_DB", "__DB_NAME__");
|
||||
}
|
||||
if (!defined('PWD_DB')) {
|
||||
define("PWD_DB", "__DB_PWD__");
|
||||
}
|
||||
if (!defined('NAME_DB')) {
|
||||
define("NAME_DB", "__DB_NAME__");
|
||||
}
|
||||
if (!defined('PREFIX_DB')) {
|
||||
define("PREFIX_DB", "galette_");
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/webroot/;
|
||||
alias __FINALPATH__/webroot;
|
||||
|
||||
if ($scheme = http) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# dependencies used by the app
|
||||
YNH_PHP_VERSION="7.3"
|
||||
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-tidy php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-curl"
|
||||
extra_php_dependencies="php${YNH_PHP_VERSION}-tidy php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-pgsql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-curl"
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
|
|
|
@ -51,11 +51,11 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the MySQL database..."
|
||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
|
|
|
@ -46,14 +46,14 @@ ynh_app_setting_set --app=$app --key=domain --value=$domain
|
|||
ynh_app_setting_set --app=$app --key=path --value=$path_url
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..." --weight=2
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -103,8 +103,8 @@ ynh_script_progression --message="Configuring Galette..." --weight=1
|
|||
|
||||
ynh_add_config --template="../conf/config.inc.php.dist" --destination="$final_path/config/config.inc.php"
|
||||
|
||||
#chmod 400 "$final_path/config/config.inc.php"
|
||||
#chown $app "$final_path/config/config.inc.php"
|
||||
chown $app $final_path/config
|
||||
chmod 750 $final_path/config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -24,12 +24,12 @@ db_user=$db_name
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..." --weight=4
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=2
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
|
|
|
@ -57,13 +57,13 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
|
|||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=5
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_name --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./db.sql
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
|
|
Loading…
Add table
Reference in a new issue