From 833cd12496aa15bd0be01b2118eb37ec6ef3a561 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 12 Jun 2023 09:51:09 +0200 Subject: [PATCH] fix --- scripts/_common.sh | 5 +++++ scripts/install | 9 +++------ scripts/upgrade | 9 +++------ 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 599c71e..0209a1b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,11 @@ # COMMON VARIABLES #================================================= +php_exec() { + (cd "$install_dir" && ynh_exec_as "$app" \ + php${YNH_PHP_VERSION} "$install_dir/bin/console" --no-interaction --env=prod "$@") +} + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 7ee9488..939b80e 100644 --- a/scripts/install +++ b/scripts/install @@ -41,25 +41,22 @@ ynh_script_progression --message="Configuring wallabag..." --weight=25 ynh_add_config --template="../conf/parameters.yml" --destination="$install_dir/app/config/parameters.yml" -# Alias for php-cli execution command -php_exec="ynh_exec_as $app php$YNH_PHP_VERSION "$install_dir/bin/console" --no-interaction --env=prod" - # Set permissions to app files chown -R $app: $install_dir # Install dependencies and Wallabag -$php_exec wallabag:install +php_exec wallabag:install # Add users to Wallabag for username in $(ynh_user_list) do user_email=$(ynh_user_get_info --username="$username" --key=mail) user_pass=$(ynh_string_random) - $php_exec fos:user:create "$username" "$user_email" "$user_pass" + php_exec fos:user:create "$username" "$user_email" "$user_pass" done # Set admin user -$php_exec fos:user:promote --super "$admin" +php_exec fos:user:promote --super "$admin" # Configure Wallabag instance URL ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name <<< "UPDATE internal_setting SET value = 'https://$domain$path' WHERE name = 'wallabag_url'" diff --git a/scripts/upgrade b/scripts/upgrade index 90c7791..9a9fee2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,18 +73,15 @@ then # UPGRADE WALLABAG #================================================= - # Alias for php-cli execution command - php_exec="ynh_exec_as $app php${YNH_PHP_VERSION} "$install_dir/bin/console" --no-interaction --env=prod" - # Set permissions to app files chown -R $app: $install_dir # Upgrade database and clear the cache - $php_exec doctrine:migrations:migrate - $php_exec cache:clear + php_exec doctrine:migrations:migrate + php_exec cache:clear # Configure Wallabag instance URL - ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name <<< "UPDATE internal_setting SET value = 'https://$domain$path' WHERE name = 'wallabag_url'" + #ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name <<< "UPDATE internal_setting SET value = 'https://$domain$path' WHERE name = 'wallabag_url'" fi #=================================================