diff --git a/conf/config.inc.php.dist b/conf/config.inc.php.dist index b2e6d86..73c471b 100644 --- a/conf/config.inc.php.dist +++ b/conf/config.inc.php.dist @@ -1,25 +1,41 @@ + * @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_"); +} diff --git a/conf/nginx.conf b/conf/nginx.conf index 71af5c3..2a32082 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -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; diff --git a/scripts/_common.sh b/scripts/_common.sh index 904c75f..07a84ad 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -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 diff --git a/scripts/backup b/scripts/backup index 8121d53..be2ba02 100644 --- a/scripts/backup +++ b/scripts/backup @@ -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 diff --git a/scripts/install b/scripts/install index 04272fb..b4de1a8 100755 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/remove b/scripts/remove index 0d83b46..716072b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -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 diff --git a/scripts/restore b/scripts/restore index 97dc7a0..c6710a0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -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