1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lychee_ynh.git synced 2024-09-03 19:36:36 +02:00

Merge pull request #32 from YunoHost-Apps/set---purge-data-dir

Set  --purge data dir
This commit is contained in:
Alexandre Aubin 2021-11-21 19:33:45 +01:00 committed by GitHub
commit 07a7c645a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 49 additions and 42 deletions

View file

@ -15,7 +15,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
Photo-management-system to manage and share photos.
Photo-management-system to manage and share photos
**Shipped version:** 4.3.4~ynh1
@ -28,7 +28,6 @@ Photo-management-system to manage and share photos.
## Documentation and resources
* Official app website: https://lycheeorg.github.io/
* Official user documentation: https://yunohost.org/en/app_lychee
* Official admin documentation: https://lycheeorg.github.io/docs/
* Upstream app code repository: https://github.com/LycheeOrg/Lychee
* YunoHost documentation for this app: https://yunohost.org/app_lychee

View file

@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble
Système de gestion de photos pour gérer et partager des photos.
Système de gestion de photos pour gérer et partager des photos
**Version incluse :** 4.3.4~ynh1
@ -24,7 +24,6 @@ Système de gestion de photos pour gérer et partager des photos.
## Documentations et ressources
* Site officiel de l'app : https://lycheeorg.github.io/
* Documentation officielle utilisateur : https://yunohost.org/en/app_lychee
* Documentation officielle de l'admin : https://lycheeorg.github.io/docs/
* Dépôt de code officiel de l'app : https://github.com/LycheeOrg/Lychee
* Documentation YunoHost pour cette app : https://yunohost.org/app_lychee

View file

@ -33,7 +33,7 @@ TIMEZONE=UTC
# folders in which the files will be stored
LYCHEE_DIST="__FINALPATH__/public/dist/"
LYCHEE_UPLOADS="__PUBLIC_PATH__/uploads/"
LYCHEE_UPLOADS="__DATADIR__/uploads/"
# url to access those files
# LYCHEE_DIST_URL="dist/"

View file

@ -31,7 +31,7 @@ location ^~ __PATH__/ {
}
location __PATH__/uploads/ {
alias __PUBLIC_PATH__/uploads/ ;
alias __DATADIR__/uploads/ ;
}
# Include SSOWAT user panel.

View file

@ -3,8 +3,8 @@
"id": "lychee",
"packaging_format": 1,
"description": {
"en": "Photo-management-system to manage and share photos.",
"fr": "Système de gestion de photos pour gérer et partager des photos."
"en": "Photo-management-system to manage and share photos",
"fr": "Système de gestion de photos pour gérer et partager des photos"
},
"version": "4.3.4~ynh1",
"url": "https://lycheeorg.github.io/",
@ -13,7 +13,6 @@
"website": "https://lycheeorg.github.io/",
"demo": "https://lycheeorg.github.io/demo/",
"admindoc": "https://lycheeorg.github.io/docs/",
"userdoc": "https://yunohost.org/en/app_lychee",
"code": "https://github.com/LycheeOrg/Lychee"
},
"license": "MIT",
@ -22,7 +21,7 @@
"email": ""
},
"requirements": {
"yunohost": ">= 4.2.4"
"yunohost": ">= 4.3.0"
},
"multi_instance": true,
"services": [
@ -34,8 +33,7 @@
"install" : [
{
"name": "domain",
"type": "domain",
"example": "example.com"
"type": "domain"
},
{
"name": "path",

View file

@ -9,9 +9,7 @@ YNH_PHP_VERSION="7.4"
# Composer version
YNH_COMPOSER_VERSION="2.1.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-exif php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-intl"
pkg_dependencies="ffmpeg"
pkg_dependencies="ffmpeg php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-exif php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-intl"
# # needed for raw upload and video playback
# # ufraw-batch is not supported in bullseye

View file

@ -24,7 +24,7 @@ ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -44,7 +44,7 @@ ynh_backup --src_path="$final_path"
# BACKUP MEDIA FOLDER
#=================================================
ynh_backup --src_path="$public_path" --is_big
ynh_backup --src_path="$datadir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -31,7 +31,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP

View file

@ -88,15 +88,15 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Creating a data directory..." --weight=1
public_path=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=public_path --value=$public_path
datadir=/home/yunohost.app/$app
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
mkdir -p $public_path/uploads
mkdir -p $public_path/uploads/{big,import,medium,raw,small,thumb}
mkdir -p $datadir/uploads
mkdir -p $datadir/uploads/{big,import,medium,raw,small,thumb}
chmod 750 "$public_path"
chmod -R o-rwx "$public_path"
chown -R $app:www-data "$public_path"
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# NGINX CONFIGURATION
@ -112,7 +112,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================

View file

@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
@ -32,6 +32,17 @@ ynh_script_progression --message="Removing app main directory..." --weight=3
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
# Remove the app data directory with the command `yunohost app remove --purge`
if [ "$YNH_APP_PURGE" == true ]
then
ynh_script_progression --message="Removing $app data directory..." --weight=2
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================

View file

@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -72,11 +72,13 @@ chown -R $app:www-data "$final_path"
ynh_script_progression --message="Restoring the data directory..."
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
ynh_restore_file --origin_path="$public_path" --not_mandatory
ynh_restore_file --origin_path="$datadir" --not_mandatory
chmod 755 "$public_path"
chmod -R o-rwx "$public_path"
chown -R $app:www-data "$public_path"
mkdir -p $datadir
chmod 755 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
#=================================================
# REINSTALL DEPENDENCIES
@ -95,7 +97,7 @@ ynh_script_progression --message="Restoring PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=low --footprint=low
#=================================================
# RESTORE THE MYSQL DATABASE

View file

@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
public_path=$(ynh_app_setting_get --app=$app --key=public_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
phpversion=$YNH_PHP_VERSION
@ -61,14 +61,14 @@ if [ -z "$final_path" ]; then
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If new public_path doesn't exist, create it
# If new datadir doesn't exist, create it
if [ -z "/home/yunohost.app/$app" ]; then
public_path=/home/yunohost.app/$app
mkdir -p $public_path
chmod 755 $public_path
chown -R $app:www-data $public_path
ynh_app_setting_set --app=$app --key=public_path --value=$public_path
cp -a "$final_path/public/uploads" "$public_path/uploads"
datadir=/home/yunohost.app/$app
mkdir -p $datadir
chmod 755 $datadir
chown -R $app:www-data $datadir
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
cp -a "$final_path/public/uploads" "$datadir/uploads"
fi
# Cleaning legacy permissions
@ -132,7 +132,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
ynh_add_fpm_config --usage=low --footprint=low
#=================================================
# PHP-FPM CONFIGURATION