From 73c66e7396b6a1a78fa22abfb773690389fc96c0 Mon Sep 17 00:00:00 2001 From: anmol26s Date: Fri, 5 Mar 2021 01:23:09 +0530 Subject: [PATCH] Fix composer and added api,dav links --- scripts/_common.sh | 2 +- scripts/install | 12 +++++++++--- scripts/restore | 7 +++++++ scripts/upgrade | 12 ++++-------- scripts/ynh_composer__2 | 7 ++++--- 5 files changed, 25 insertions(+), 15 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 6254bc4..d73ec6b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ # dependencies used by the app pkg_dependencies="redis-server" - +YNH_COMPOSER_VERSION="2.0.11" YNH_PHP_VERSION="7.3" extra_php_dependencies="php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-redis" diff --git a/scripts/install b/scripts/install index 2f7ef65..f4cce8f 100755 --- a/scripts/install +++ b/scripts/install @@ -205,7 +205,7 @@ ynh_store_file_checksum --file="$config" ynh_script_progression --message="Installing the cron file..." echo "* * * * * -u $app /usr/bin/php$phpversion $final_path/artisan schedule:run" > /tmp/cron$app -mv /tmp/cron$app /etc/cron.d/$app +mv -f /tmp/cron$app /etc/cron.d/$app #================================================= # GENERIC FINALIZATION @@ -226,10 +226,16 @@ ynh_script_progression --message="Configuring SSOwat..." # Make app public if necessary if [ $is_public -eq 1 ] then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" + # Everyone can access the app. + # The "main" permission is automatically created before the install script. + ynh_permission_update --permission="main" --add="visitors" fi +# Giver API permission to visitors +ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true" +# Giver DAV permission to visitors +ynh_permission_create --permission="dav" --url "/dav" --allowed="visitors" --show_tile="false" --protected="true" + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/restore b/scripts/restore index 4248aa3..f0ecb61 100755 --- a/scripts/restore +++ b/scripts/restore @@ -113,6 +113,13 @@ ynh_script_progression --message="Restoring the cron file..." ynh_restore_file --origin_path="/etc/cron.d/$app" +#================================================= +# RESTORE THE CRON FILE +#================================================= +ynh_script_progression --message="Restoring the cron file..." + +ynh_restore_file --origin_path="/etc/cron.d/$app" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 82a9c14..8a3372e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -256,16 +256,12 @@ chown -R $app: $final_path chmod -R 775 "$final_path/storage" #================================================= -# SETUP SSOWAT +# INSTALL THE CRON FILE #================================================= -ynh_script_progression --message="Upgrading SSOwat configuration..." +ynh_script_progression --message="Installing the cron file..." -# Make app public if necessary -if [ $is_public -eq 1 ] -then - # unprotected_uris allows SSO credentials to be passed anyway - ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" -fi +echo "* * * * * -u $app /usr/bin/php$phpversion $final_path/artisan schedule:run" > /tmp/cron$app +mv -f /tmp/cron$app /etc/cron.d/$app #================================================= # RELOAD NGINX diff --git a/scripts/ynh_composer__2 b/scripts/ynh_composer__2 index 532a01c..6b21e43 100644 --- a/scripts/ynh_composer__2 +++ b/scripts/ynh_composer__2 @@ -25,7 +25,7 @@ ynh_composer_exec () { COMPOSER_HOME="$workdir/.composer" \ php${phpversion} "$workdir/composer.phar" $commands \ - -d "$workdir" --no-interaction + -d "$workdir" --quiet --no-interaction } # Install and initialize Composer in the given directory @@ -34,6 +34,7 @@ ynh_composer_exec () { # | arg: -v, --phpversion - PHP version to use with composer # | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. # | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include +# | arg: -c, --composerversion - Composer version to install ynh_install_composer () { # Declare an array to define the options of this helper. local legacy_args=vwa @@ -51,10 +52,10 @@ ynh_install_composer () { curl -sS https://getcomposer.org/installer \ | COMPOSER_HOME="$workdir/.composer" \ - php${phpversion} -- --install-dir="$workdir" --version="$composerversion" \ + php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \ || ynh_die "Unable to install Composer." # update dependencies to create composer.lock ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \ || ynh_die "Unable to update core dependencies with Composer." -} +} \ No newline at end of file