From b6091c4f70ebe06a9d26fd6104431ab8e74f02ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 11 Jun 2023 12:35:31 +0200 Subject: [PATCH] cleaning --- scripts/_common.sh | 8 -------- scripts/install | 6 ++++++ scripts/upgrade | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6366b74..5591139 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,14 +4,6 @@ # COMMON FUCTIONS #================================================= -# Define a function to execute commands with `occ` -exec_occ() { - (cd "$install_dir" && ynh_exec_as "$app" \ - php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@") -} - -#================================================= - # Define a function to add an external storage # Create the external storage for the given folders and enable sharing create_external_storage() { diff --git a/scripts/install b/scripts/install index 82d8345..f0673b1 100755 --- a/scripts/install +++ b/scripts/install @@ -79,6 +79,12 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Installing $app..." --weight=30 +# Define a function to execute commands with `occ` +exec_occ() { + (cd "$install_dir" && ynh_exec_as "$app" \ + php${phpversion} --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@") +} + # Set write access for the following commands chown -R $app: "$install_dir" "$data_dir" diff --git a/scripts/upgrade b/scripts/upgrade index 6c23616..49e5a73 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -112,6 +112,25 @@ exec_occ() { php$NEXTCLOUD_PHP_VERSION --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@") } +# Define a function to execute commands with `occ` +exec_occ() { + # Backward compatibility to upgrade from older versions + if [ $current_major_version = "last" ] + then + NEXTCLOUD_PHP_VERSION=$phpversion + elif [ $current_major_version -ge 24 ] + then + NEXTCLOUD_PHP_VERSION="8.0" + elif [ $current_major_version -ge 15 ] + then + NEXTCLOUD_PHP_VERSION="7.4" + else + NEXTCLOUD_PHP_VERSION="7.0" + fi +(cd "$install_dir" && ynh_exec_as "$app" \ + php$NEXTCLOUD_PHP_VERSION --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@") +} + #================================================= # HANDLE DATABASE MIGRATION #=================================================