From b9056f7432e2801785d041bd59bfd56f028a385f Mon Sep 17 00:00:00 2001
From: eric_G <46165813+ericgaspar@users.noreply.github.com>
Date: Wed, 19 Jun 2024 00:38:49 +0200
Subject: [PATCH] Testing (#117)
---
README.md | 2 +-
README_es.md | 2 +-
README_eu.md | 2 +-
README_fr.md | 2 +-
README_gl.md | 2 +-
README_zh_Hans.md | 2 +-
conf/.env | 183 ++++++++++++++++++++++++++++++++++++++++
conf/.env.example | 94 ---------------------
conf/extra_php-fpm.conf | 4 +
manifest.toml | 8 +-
scripts/_common.sh | 4 +-
scripts/backup | 4 -
scripts/install | 68 ++++-----------
scripts/remove | 7 +-
scripts/restore | 25 ++----
scripts/upgrade | 50 +++--------
16 files changed, 241 insertions(+), 218 deletions(-)
create mode 100644 conf/.env
delete mode 100644 conf/.env.example
diff --git a/README.md b/README.md
index 5fc2d1b..c000f59 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@ Upload, manage and share photos like from a native application.
Lychee comes with everything you need and all your photos are stored securely.
-**Shipped version:** 5.3.1~ynh1
+**Shipped version:** 5.4.0~ynh1
**Demo:**
diff --git a/README_es.md b/README_es.md
index e8f7cdc..14a8409 100644
--- a/README_es.md
+++ b/README_es.md
@@ -21,7 +21,7 @@ Upload, manage and share photos like from a native application.
Lychee comes with everything you need and all your photos are stored securely.
-**Versión actual:** 5.3.1~ynh1
+**Versión actual:** 5.4.0~ynh1
**Demo:**
diff --git a/README_eu.md b/README_eu.md
index 78e726e..cd53031 100644
--- a/README_eu.md
+++ b/README_eu.md
@@ -21,7 +21,7 @@ Upload, manage and share photos like from a native application.
Lychee comes with everything you need and all your photos are stored securely.
-**Paketatutako bertsioa:** 5.3.1~ynh1
+**Paketatutako bertsioa:** 5.4.0~ynh1
**Demoa:**
diff --git a/README_fr.md b/README_fr.md
index 7e84c20..f2978f4 100644
--- a/README_fr.md
+++ b/README_fr.md
@@ -21,7 +21,7 @@ Téléchargez, gérez et partagez des photos comme à partir d'une application n
Lychee est livré avec tout ce dont vous avez besoin et toutes vos photos sont stockées en toute sécurité.
-**Version incluse :** 5.3.1~ynh1
+**Version incluse :** 5.4.0~ynh1
**Démo :**
diff --git a/README_gl.md b/README_gl.md
index 3d35914..4f51d1b 100644
--- a/README_gl.md
+++ b/README_gl.md
@@ -21,7 +21,7 @@ Upload, manage and share photos like from a native application.
Lychee comes with everything you need and all your photos are stored securely.
-**Versión proporcionada:** 5.3.1~ynh1
+**Versión proporcionada:** 5.4.0~ynh1
**Demo:**
diff --git a/README_zh_Hans.md b/README_zh_Hans.md
index 9220f11..d570ec8 100644
--- a/README_zh_Hans.md
+++ b/README_zh_Hans.md
@@ -21,7 +21,7 @@ Upload, manage and share photos like from a native application.
Lychee comes with everything you need and all your photos are stored securely.
-**分发版本:** 5.3.1~ynh1
+**分发版本:** 5.4.0~ynh1
**演示:**
diff --git a/conf/.env b/conf/.env
new file mode 100644
index 0000000..e257a54
--- /dev/null
+++ b/conf/.env
@@ -0,0 +1,183 @@
+APP_NAME=Lychee
+APP_ENV=production
+APP_KEY=
+APP_DEBUG=false
+# This MUST contain the host name up to the Top Level Domain (tld) e.g. .com, .org etc.
+APP_URL=https://__DOMAIN__
+APP_FORCE_HTTPS=false
+
+# If using Lychee in a sub folder, specify the path after the tld here.
+# For example for https://lychee.test/path/to/lychee
+# Set APP_URL=https://lychee.test
+# and APP_DIR=/path/to/lychee
+# We (LycheeOrg) do not recommend the use of APP_DIR.
+APP_DIR=__PATH__/
+
+# enable or disable debug bar. By default it is disabled.
+# Do note that this disable CSP!!
+DEBUGBAR_ENABLED=true
+
+# enable or disable the v5 layout.
+LIVEWIRE_ENABLED=true
+
+# enable or disable log viewer. By default it is enabled.
+LOG_VIEWER_ENABLED=true
+
+# enable s3 bucket (required in addition to needing AWS_ACCESS_KEY_ID)
+# S3_ENABLED=true
+
+# If you spread old links of to your albums in your Lychee instance starting with
+# https://lychee.text/#albumID/PhotoId
+# Set this value to true to enable redirection.
+LEGACY_V4_REDIRECT=false
+
+##############################################################################
+# IMPORTANT: To migrate from Lychee v3 you *MUST* use the same MySQL/MariaDB #
+# server as v3. #
+##############################################################################
+
+# Table prefix (e.g. lychee_) of a Lychee v3 instance for migration
+DB_OLD_LYCHEE_PREFIX=
+
+# DB_CONNECTION can be sqlite, mysql or pgsql. For sqlite the other entries are
+# not required, but an existing sqlite3 database may be specified if desired. In
+# this case, please use an absolute path. DB_DATABASE may be omitted but should
+# *not* be left blank.
+DB_CONNECTION=mysql
+DB_HOST=127.0.0.1
+DB_PORT=3306
+DB_DATABASE=__DB_NAME__
+DB_USERNAME=__DB_USER__
+DB_PASSWORD=__DB_PWD__
+DB_LOG_SQL=false
+
+# List foreign keys in diagnostic page
+DB_LIST_FOREIGN_KEYS=false
+
+# Application timezone. If not specified, the server's default timezone is used.
+# Requires a named timezone identifier.
+# See https://www.php.net/manual/en/timezones.php for the list of supported timezones.
+# Don't use a timezone offset (like +01:00) or a timezone abbreviation (like CEST)
+TIMEZONE=__TIMEZONE__
+
+# Visibility of directories and (media) files in LYCHEE_UPLOADS
+# Possible values are:
+#
+# - private: world group has neither read nor write access
+# - public: world group has read access but no write access (the default)
+# - world: world group has read and write access
+#
+# The default should suffice for most installations.
+# For improved security, change this setting to "private".
+# Some rare setups may require directories and files to be world writeable.
+# In this case, use "world" here.
+# USE WITH PRECAUTIONS: world writeable files and folders may be a SECURITY RISK.
+# LYCHEE_IMAGE_VISIBILITY=public
+
+# folders in which the files will be stored
+LYCHEE_UPLOADS="__DATA_DIR__/uploads/"
+LYCHEE_DIST="__INSTALL_DIR__/public/dist/"
+LYCHEE_SYM="__INSTALL_DIR__/public/sym/"
+# url to access those files
+# LYCHEE_UPLOADS_URL="uploads/"
+# LYCHEE_DIST_URL="dist/"
+# LYCHEE_SYM_URL="sym/"
+
+# Support for token based authentication used by API requests. Enabled by default.
+# ENABLE_TOKEN_AUTH=true
+
+CACHE_DRIVER=file
+SESSION_DRIVER=file
+SESSION_LIFETIME=120
+# `sync` if jobs needs to be executed live (default) or `database` if they can be defered.
+QUEUE_CONNECTION=sync
+
+SECURITY_HEADER_HSTS_ENABLE=false
+SECURITY_HEADER_CSP_CONNECT_SRC=
+SECURITY_HEADER_SCRIPT_SRC_ALLOW=
+SESSION_SECURE_COOKIE=false
+
+REDIS_HOST=127.0.0.1
+REDIS_PASSWORD=null
+REDIS_PORT=6379
+
+MAIL_DRIVER=smtp
+MAIL_HOST=localhost
+MAIL_PORT=25
+MAIL_USERNAME=__APP__
+MAIL_PASSWORD=__MAIL_PWD__
+MAIL_ENCRYPTION=false
+MAIL_FROM_NAME=lychee
+MAIL_FROM_ADDRESS=lychee@__DOMAIN__
+
+# The trusted proxies if Lychee is behind a reverse proxy
+# Accepted values:
+# - `null`: no proxy
+# - `*`: any proxy
+# - [,]: a comma-seperated list of IP addresses
+TRUSTED_PROXIES=null
+
+# Comma-separated list of class names of diagnostics checks that should be skipped.
+#SKIP_DIAGNOSTICS_CHECKS=
+
+VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
+VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
+
+# Oauth token data
+# XXX_REDIRECT_URI should be left as default unless you know exactly what you do.
+
+# AMAZON_SIGNIN_CLIENT_ID=
+# AMAZON_SIGNIN_SECRET=
+# AMAZON_SIGNIN_REDIRECT_URI=/auth/amazon/redirect
+
+# https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple
+# Note: the client secret used for "Sign In with Apple" is a JWT token that can have a maximum lifetime of 6 months.
+# The article above explains how to generate the client secret on demand and you'll need to update this every 6 months.
+# To generate the client secret for each request, see Generating A Client Secret For Sign In With Apple On Each Request.
+# https://bannister.me/blog/generating-a-client-secret-for-sign-in-with-apple-on-each-request
+# APPLE_CLIENT_ID=
+# APPLE_CLIENT_SECRET=
+# APPLE_REDIRECT_URI=/auth/apple/redirect
+
+# FACEBOOK_CLIENT_ID=
+# FACEBOOK_CLIENT_SECRET=
+# FACEBOOK_REDIRECT_URI=/auth/facebook/redirect
+
+# GITHUB_CLIENT_ID=
+# GITHUB_CLIENT_SECRET=
+# GITHUB_REDIRECT_URI=/auth/github/redirect
+
+# GOOGLE_CLIENT_ID=
+# GOOGLE_CLIENT_SECRET=
+# GOOGLE_REDIRECT_URI=/auth/google/redirect
+
+# MASTODON_DOMAIN=https://mastodon.social
+# MASTODON_ID=
+# MASTODON_SECRET=
+# MASTODON_REDIRECT_URI=/auth/mastodon/redirect
+
+# MICROSOFT_CLIENT_ID=
+# MICROSOFT_CLIENT_SECRET=
+# MICROSOFT_REDIRECT_URI=/auth/microsoft/redirect
+
+# NEXTCLOUD_CLIENT_ID=
+# NEXTCLOUD_CLIENT_SECRET=
+# NEXTCLOUD_REDIRECT_URI=/auth/nextcloud/redirect
+# NEXTCLOUD_BASE_URI=
+
+# KEYCLOAK_CLIENT_ID=
+# KEYCLOAK_CLIENT_SECRET=
+# KEYCLOAK_REDIRECT_URI=/auth/keycloak/redirect
+# KEYCLOAK_BASE_URL=
+# KEYCLOAK_REALM=
+
+# AWS support data
+
+# AWS_ACCESS_KEY_ID=
+# AWS_SECRET_ACCESS_KEY=
+# AWS_DEFAULT_REGION=
+# AWS_BUCKET=
+# AWS_URL=
+# AWS_ENDPOINT=
+# AWS_IMAGE_VISIBILITY=
+# AWS_USE_PATH_STYLE_ENDPOINT=
diff --git a/conf/.env.example b/conf/.env.example
deleted file mode 100644
index efe6539..0000000
--- a/conf/.env.example
+++ /dev/null
@@ -1,94 +0,0 @@
-APP_NAME=Lychee
-APP_ENV=production
-APP_KEY=
-APP_DEBUG=false
-APP_URL=https://__DOMAIN____PATH__
-APP_FORCE_HTTPS=true
-
-# enable or disable debug bar. By default it is disabled.
-DEBUGBAR_ENABLED=false
-
-##############################################################################
-# IMPORTANT: To migrate from Lychee v3 you *MUST* use the same MySQL/MariaDB #
-# server as v3. #
-##############################################################################
-
-# Table prefix (e.g. lychee_) of a Lychee v3 instance for migration
-DB_OLD_LYCHEE_PREFIX=
-
-# DB_CONNECTION can be sqlite, mysql or pgsql. For sqlite the other entries are
-# not required, but an existing sqlite3 database may be specified if desired. In
-# this case, please use an absolute path. DB_DATABASE may be omitted but should
-# *not* be left blank.
-DB_CONNECTION=mysql
-DB_HOST=127.0.0.1
-DB_PORT=3306
-DB_DATABASE=__DB_NAME__
-DB_USERNAME=__DB_USER__
-DB_PASSWORD=__DB_PWD__
-DB_LOG_SQL=false
-
-# List foreign keys in diagnostic page
-#DB_LIST_FOREIGN_KEYS=true
-
-# Application timezone. If not specified, the server's default timezone is used.
-# Requires a named timezone identifier.
-# See https://www.php.net/manual/en/timezones.php for the list of supported timezones.
-# Don't use a timezone offset (like +01:00) or a timezone abbreviation (like CEST)
-TIMEZONE=__TIMEZONE__
-
-# Visibility of directories and (media) files in LYCHEE_UPLOADS
-# Possible values are:
-#
-# - private: world group has neither read nor write access
-# - public: world group has read access but no write access (the default)
-# - world: world group has read and write access
-#
-# The default should suffice for most installations.
-# For improved security, change this setting to "private".
-# Some rare setups may require directories and files to be world writeable.
-# In this case, use "world" here.
-# USE WITH PRECAUTIONS: world writeable files and folders may be a SECURITY RISK.
-LYCHEE_IMAGE_VISIBILITY=public
-
-# folders in which the files will be stored
-LYCHEE_UPLOADS="__DATA_DIR__/uploads/"
-LYCHEE_DIST="__INSTALL_DIR__/public/dist/"
-# LYCHEE_SYM="/var/www/html/Lychee-Laravel/public/sym/"
-# url to access those files
-# LYCHEE_UPLOADS_URL="uploads/"
-# LYCHEE_DIST_URL="dist/"
-# LYCHEE_SYM_URL="sym/"
-
-# Support for token based authentication used by API requests. Enabled by default.
-ENABLE_TOKEN_AUTH=false
-
-CACHE_DRIVER=file
-SESSION_DRIVER=file
-SESSION_LIFETIME=120
-
-SECURITY_HEADER_HSTS_ENABLE=false
-SESSION_SECURE_COOKIE=false
-
-REDIS_HOST=127.0.0.1
-REDIS_PASSWORD=null
-REDIS_PORT=6379
-
-MAIL_DRIVER=smtp
-MAIL_HOST=localhost
-MAIL_PORT=25
-MAIL_USERNAME=__APP__
-MAIL_PASSWORD=__MAIL_PWD__
-MAIL_ENCRYPTION=false
-MAIL_FROM_NAME=lychee
-MAIL_FROM_ADDRESS=lychee@__DOMAIN__
-
-# The trusted proxies if Lychee is behind a reverse proxy
-# Accepted values:
-# - `null`: no proxy
-# - `*`: any proxy
-# - [,]: a comma-seperated list of IP addresses
-TRUSTED_PROXIES=null
-
-# Comma-separated list of class names of diagnostics checks that should be skipped.
-#SKIP_DIAGNOSTICS_CHECKS=
diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf
index 1f6b70e..03371cb 100644
--- a/conf/extra_php-fpm.conf
+++ b/conf/extra_php-fpm.conf
@@ -2,3 +2,7 @@
php_admin_value[upload_max_filesize] = 1G
php_admin_value[post_max_size] = 1G
+php_admin_value[max_execution_time] = 200
+php_admin_value[upload_max_size] = 100M
+php_admin_value[memory_limit]= 256M
+
diff --git a/manifest.toml b/manifest.toml
index 3342228..357446a 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -5,7 +5,7 @@ name = "Lychee"
description.en = "Photo-management-system to manage and share photos"
description.fr = "Système de gestion de photos pour gérer et partager des photos"
-version = "5.3.1~ynh1"
+version = "5.4.0~ynh1"
maintainers = []
@@ -46,8 +46,8 @@ ram.runtime = "50M"
[resources.sources]
[resources.sources.main]
- url = "https://github.com/LycheeOrg/Lychee/archive/refs/tags/v5.3.1.tar.gz"
- sha256 = "4b45b2f486f2c3088aecea4682b9a5159c2b1c7657785f3580e2443c4256184e"
+ url = "https://github.com/LycheeOrg/Lychee/releases/download/v5.4.0/Lychee.zip"
+ sha256 = "bdee8831cd5564ab1e691eaf51dba9b176a977be39eb39d5dcceab1064b82c61"
autoupdate.strategy = "latest_github_tag"
[resources.system_user]
@@ -63,7 +63,7 @@ ram.runtime = "50M"
main.auth_header = false
[resources.apt]
- packages = "mariadb-server, ffmpeg, php8.2-xml, php8.2-imagick, php8.2-bcmath, php8.2-exif, php8.2-mbstring, php8.2-gd, php8.2-mysqli, php8.2-zip, php8.2-intl"
+ packages = "mariadb-server, ffmpeg, php8.3-xml, php8.3-imagick, php8.3-bcmath, php8.3-exif, php8.3-mbstring, php8.3-gd, php8.3-mysqli, php8.3-zip, php8.3-intl"
[resources.database]
type = "mysql"
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 27567b9..6381490 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -5,9 +5,7 @@
#=================================================
# Composer version
-YNH_COMPOSER_VERSION="2.5.4"
-
-nodejs_version=16
+YNH_COMPOSER_VERSION="2.7.7"
#=================================================
# PERSONAL HELPERS
diff --git a/scripts/backup b/scripts/backup
index 60cea71..a5522cf 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -33,10 +33,6 @@ ynh_backup --src_path="$data_dir" --is_big
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# BACKUP THE PHP-FPM CONFIGURATION
-#=================================================
-
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
diff --git a/scripts/install b/scripts/install
index e62f9ab..ee078e3 100755
--- a/scripts/install
+++ b/scripts/install
@@ -10,19 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
-# RETRIEVE ARGUMENTS FROM THE MANIFEST
+# INITIALIZE AND STORE SETTINGS
#=================================================
timezone="$(cat /etc/timezone)"
-#=================================================
-# INSTALL DEPENDENCIES
-#=================================================
-ynh_script_progression --message="Installing dependencies..." --weight=7
-
-# Install Nodejs
-ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
-
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@@ -31,16 +23,23 @@ ynh_script_progression --message="Setting up source files..." --weight=3
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
-chmod 750 "$install_dir/bootstrap/cache"
-chmod -R o-rwx "$install_dir"
+chmod o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
-chown -R "$app:" "$install_dir/public/sym/"
-chmod -R 755 "$data_dir"
#=================================================
-# PHP-FPM CONFIGURATION
+# APP INITIAL CONFIGURATION
#=================================================
-ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
+ynh_script_progression --message="Adding $app's configuration files..." --weight=1
+
+ynh_add_config --template=".env" --destination="$install_dir/.env"
+
+chmod 400 "$install_dir/.env"
+chown "$app:$app" "$install_dir/.env"
+
+#=================================================
+# SYSTEM CONFIGURATION
+#=================================================
+ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
@@ -48,16 +47,6 @@ ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
-#=================================================
-# SPECIFIC SETUP
-#=================================================
-# CREATE DATA DIRECTORY
-#=================================================
-ynh_script_progression --message="Creating a data directory..." --weight=1
-
-chgrp "$app" -R "$install_dir/storage" "$install_dir/public/dist" "$install_dir/public/sym" "$data_dir/uploads"
-chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public/dist" "$install_dir/public/sym" "$data_dir/uploads" "$install_dir/bootstrap/"
-
#=================================================
# INSTALL APP WITH COMPOSER
#=================================================
@@ -65,31 +54,10 @@ ynh_script_progression --message="Installing app with Composer..." --weight=15
ynh_install_composer
-#=================================================
-# INSTALL LYCHEE
-#=================================================
-ynh_script_progression --message="Installing $app..." --weight=10
-
-pushd "$install_dir"
- ynh_use_nodejs
- ynh_exec_warn_less sudo -u "$app" env "$ynh_node_load_PATH" "$ynh_npm" install
- ynh_exec_warn_less sudo -u "$app" env "$ynh_node_load_PATH" NODE_ENV=production "$ynh_npm" run build
-popd
-
-#=================================================
-# ADD A CONFIGURATION
-#=================================================
-ynh_script_progression --message="Adding a configuration file..."
-
-ynh_add_config --template=".env.example" --destination="$install_dir/.env"
-
-chmod 400 "$install_dir/.env"
-chown "$app:$app" "$install_dir/.env"
-
#=================================================
# BUILDING
#=================================================
-ynh_script_progression --message="Building..." --weight=10
+ynh_script_progression --message="configuring $app..." --weight=10
pushd "$install_dir"
"php$phpversion" artisan key:generate -n --force --env
@@ -98,10 +66,10 @@ pushd "$install_dir"
"php$phpversion" artisan config:cache -n
popd
-chmod 750 "$install_dir"
-chmod 750 "$install_dir/bootstrap/cache"
-chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
+chmod -R 775 /home/yunohost.app/$app/
+chgrp "$app" -R "$install_dir/storage" "$install_dir/public/dist" "$install_dir/public/sym" "$data_dir/uploads"
+chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public/dist" "$install_dir/public/sym" "$data_dir/uploads" "$install_dir/bootstrap/"
#=================================================
# END OF SCRIPT
diff --git a/scripts/remove b/scripts/remove
index 04e45b2..5b17c2d 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -10,9 +10,9 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
-# REMOVE NGINX CONFIGURATION
+# REMOVE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
+ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
@@ -20,9 +20,6 @@ ynh_remove_nginx_config
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
-# Remove NodeJS
-ynh_remove_nodejs
-
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/scripts/restore b/scripts/restore
index d96cfa4..7061c6c 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -17,37 +17,30 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
-chmod 750 "$install_dir/bootstrap/cache"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
+chgrp "$app" -R "$install_dir/storage" "$install_dir/public/dist" "$install_dir/public/sym"
+chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public/dist" "$install_dir/public/sym" "$install_dir/bootstrap/"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
-ynh_script_progression --message="Restoring the data directory..."
+ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$data_dir" --not_mandatory
+chmod -R 775 "$data_dir"
chown -R "$app:www-data" "$data_dir"
+chgrp "$app" -R "$data_dir/uploads"
+chmod -R 2775 "$data_dir/uploads"
#=================================================
-# REINSTALL DEPENDENCIES
+# RESTORE SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Reinstalling dependencies..." --weight=7
-
-# Install Nodejs
-ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
-
-#=================================================
-# RESTORE THE PHP-FPM CONFIGURATION
-#=================================================
-ynh_script_progression --message="Restoring the PHP-FPM configuration..."
+ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
-# Recreate a dedicated PHP-FPM config
-ynh_add_fpm_config
-
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
@@ -57,7 +50,7 @@ ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
-ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
+ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
ynh_systemd_action --service_name=nginx --action=reload
diff --git a/scripts/upgrade b/scripts/upgrade
index 146b349..958519f 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -17,24 +17,25 @@ timezone="$(cat /etc/timezone)"
ynh_script_progression --message="Upgrading source files..." --weight=4
# Download, check integrity, uncompress and patch the source from app.src
-ynh_setup_source --dest_dir="$install_dir" --keep=".env" #--full_replace=1
+ynh_setup_source --dest_dir="$install_dir" --keep=".env public/uploads/" --full_replace=1
-chmod 750 "$install_dir/bootstrap/cache"
-chmod -R o-rwx "$install_dir"
+chmod o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
-# UPGRADE DEPENDENCIES
+# UPDATE A CONFIG FILE
#=================================================
-ynh_script_progression --message="Upgrading dependencies..." --weight=5
+ynh_script_progression --message="Updating a configuration file..." --weight=1
-# Install Nodejs
-ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
+ynh_add_config --template=".env" --destination="$install_dir/.env"
+
+chmod 400 "$install_dir/.env"
+chown "$app:$app" "$install_dir/.env"
#=================================================
-# PHP-FPM CONFIGURATION
+# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
+ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
@@ -42,18 +43,6 @@ ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
-#=================================================
-# SPECIFIC UPGRADE
-#=================================================
-# UPDATE A CONFIG FILE
-#=================================================
-ynh_script_progression --message="Updating a configuration file..."
-
-ynh_add_config --template=".env.example" --destination="$install_dir/.env"
-
-chmod 400 "$install_dir/.env"
-chown "$app:$app" "$install_dir/.env"
-
#=================================================
# INSTALL APP WITH COMPOSER
#=================================================
@@ -61,21 +50,10 @@ ynh_script_progression --message="Installing app with Composer..." --weight=1
ynh_install_composer
-#=================================================
-# INSTALL LYCHEE
-#=================================================
-ynh_script_progression --message="Installing $app..." --weight=10
-
-pushd "$install_dir"
- ynh_use_nodejs
- ynh_exec_warn_less sudo -u "$app" env "$ynh_node_load_PATH" "$ynh_npm" install
- ynh_exec_warn_less sudo -u "$app" env "$ynh_node_load_PATH" NODE_ENV=production "$ynh_npm" run build
-popd
-
#=================================================
# BUILDING
#=================================================
-ynh_script_progression --message="Building..." --weight=4
+ynh_script_progression --message="Configuring $app..." --weight=4
ynh_exec_warn_less ynh_composer_exec --commands="dump-autoload"
@@ -87,10 +65,10 @@ pushd "$install_dir"
"php$phpversion" artisan view:clear
popd
-chmod 750 "$install_dir"
-chmod 750 "$install_dir/bootstrap/cache"
-chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
+chmod -R 775 /home/yunohost.app/$app/
+chgrp "$app" -R "$install_dir/storage" "$install_dir/public/dist" "$install_dir/public/sym" "$data_dir/uploads"
+chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public/dist" "$install_dir/public/sym" "$data_dir/uploads" "$install_dir/bootstrap/"
#=================================================
# END OF SCRIPT