diff --git a/README.md b/README.md index 0a4c54c..71747f3 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in [Piwigo](http://piwigo.org) is a photo gallery software for the web, built by an active community of users and developers. Extensions make Piwigo easily customizable. -**Shipped version:** 12.1.0~ynh1 +**Shipped version:** 12.2.0~ynh1 **Demo:** https://piwigo.org/demo diff --git a/README_fr.md b/README_fr.md index d15d2fe..cb07199 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour [Piwigo](http://piwigo.org) is a photo gallery software for the web, built by an active community of users and developers. Extensions make Piwigo easily customizable. -**Version incluse :** 12.1.0~ynh1 +**Version incluse :** 12.2.0~ynh1 **Démo :** https://piwigo.org/demo diff --git a/check_process b/check_process index 1fd27ee..68cf7a8 100644 --- a/check_process +++ b/check_process @@ -2,9 +2,9 @@ ; Manifest domain="domain.tld" path="/path" - admin="john" - language="fr" is_public=1 + language="fr" + admin="john" ; Checks pkg_linter=1 setup_sub_dir=1 @@ -13,14 +13,15 @@ setup_private=1 setup_public=1 upgrade=1 + # 12.0.0~ynh1 upgrade=1 from_commit=bc9ab6f21a7dcaab9245ef5cbfc9d6c4bd026925 + # 12.1.0~ynh1 + upgrade=1 from_commit=cd09a41142c55f4d4c0e654574ccb3e9d1ad3f91 backup_restore=1 multi_instance=1 + port_already_use=0 change_url=1 ;;; Options Email= Notification=none ;;; Upgrade options - ; commit=bc9ab6f21a7dcaab9245ef5cbfc9d6c4bd026925 - name=12.0.0 - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1& diff --git a/conf/app.src b/conf/app.src index 4e4d5a1..4e07bb6 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,7 @@ -SOURCE_URL=https://piwigo.org/download/dlcounter.php?code=12.1.0 -SOURCE_SUM=538c8b6974cf69720f683f082cf413db0e122e1ce52a81e491cd5145b8948e3c +SOURCE_URL=https://piwigo.org/download/dlcounter.php?code=12.2.0 +SOURCE_SUM=824ee83f46654b68962263567f2957933d75b2bac016e6dbb9ea9df9a2a86e88 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index f33ff98..28469eb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,15 +2,13 @@ location __PATH__/ { # Path to source - alias __FINALPATH__/ ; + alias __FINALPATH__/; - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - - client_max_body_size 100M; index index.php; + + # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file + client_max_body_size 100M; + default_type text/html; location ~ [^/]\.php(/|$) { fastcgi_split_path_info ^(.+?\.php)(/.*)$; diff --git a/manifest.json b/manifest.json index d4327f7..d93ad5d 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open source photo gallery for the web", "fr": "Galerie de photos open source pour le web" }, - "version": "12.1.0~ynh1", + "version": "12.2.0~ynh1", "url": "http://piwigo.org", "upstream": { "license": "GPL-2.0", @@ -22,7 +22,7 @@ "url": "" }, "requirements": { - "yunohost": ">= 4.2.3" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ @@ -31,7 +31,7 @@ "mysql" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", "type": "domain" @@ -42,10 +42,6 @@ "example": "/piwigo", "default": "/piwigo" }, - { - "name": "admin", - "type": "user" - }, { "name": "is_public", "type": "boolean", @@ -60,7 +56,11 @@ }, "choices": ["de", "en", "es", "fr", "it", "pt"], "default": "en" - } + }, + { + "name": "admin", + "type": "user" + } ] } } diff --git a/scripts/_common.sh b/scripts/_common.sh index 27ce9e1..056bb7f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,9 +7,7 @@ YNH_PHP_VERSION="7.3" # dependencies used by the app -pkg_dependencies="imagemagick" - -extra_php_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysqli" +pkg_dependencies="imagemagick php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysqli" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 9cf719f..3ab9f0b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -41,6 +41,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datapath" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -60,12 +66,6 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" -#================================================= -# BACKUP THE DATA DIRECTORY -#================================================= - -ynh_backup --src_path="$datapath" --is_big - #================================================= # BACKUP THE MYSQL DATABASE #================================================= diff --git a/scripts/change_url b/scripts/change_url index 243e746..58c7fa5 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -48,7 +48,7 @@ fi #================================================= # STANDARD MODIFICATIONS #================================================= -# MODIFY URL IN NGINX CONF FILE +# MODIFY URL IN NGINX CONF #================================================= ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2 diff --git a/scripts/install b/scripts/install index 7a0c80a..7a7797e 100644 --- a/scripts/install +++ b/scripts/install @@ -22,9 +22,9 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH -admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE +admin=$YNH_APP_ARG_ADMIN app=$YNH_APP_INSTANCE_NAME @@ -46,9 +46,9 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=language --value=$language +ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= # STANDARD MODIFICATIONS @@ -65,7 +65,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # CREATE A MYSQL DATABASE @@ -126,6 +126,15 @@ ynh_app_setting_set --app=$app --key=datapath --value=$datapath ynh_secure_remove --file="$tmpdir" +#================================================= +# PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 + +# Create a dedicated PHP-FPM config +ynh_add_fpm_config +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + #================================================= # NGINX CONFIGURATION #================================================= @@ -134,15 +143,6 @@ ynh_script_progression --message="Configuring NGINX web server..." # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# PHP-FPM CONFIGURATION -#================================================= -ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 - -# Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) - #================================================= # SPECIFIC SETUP #================================================= diff --git a/scripts/remove b/scripts/remove index dbba742..b7608a5 100644 --- a/scripts/remove +++ b/scripts/remove @@ -32,14 +32,6 @@ ynh_script_progression --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - -# Remove metapackage and its dependencies -ynh_remove_app_dependencies - #================================================= # REMOVE APP MAIN DIR #================================================= @@ -75,6 +67,14 @@ ynh_script_progression --message="Removing PHP-FPM configuration..." # Remove the dedicated PHP-FPM config ynh_remove_fpm_config +#================================================= +# REMOVE DEPENDENCIES +#================================================= +ynh_script_progression --message="Removing dependencies..." + +# Remove metapackage and its dependencies +ynh_remove_app_dependencies + #================================================= # REMOVE FAIL2BAN CONFIGURATION #================================================= diff --git a/scripts/restore b/scripts/restore index 5f11de8..4612197 100644 --- a/scripts/restore +++ b/scripts/restore @@ -42,25 +42,18 @@ test ! -d $final_path \ #================================================= # STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring app main directory..." +ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" @@ -69,16 +62,19 @@ chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" #================================================= -# RESTORE THE PHP-FPM CONFIGURATION +# RESTORE THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=10 +ynh_script_progression --message="Restoring data directory..." -# Restore the file first, so it can have a backup if different -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +# 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="$datapath" --not_mandatory -# Recreate a dedicated php-fpm config -ynh_add_fpm_config --package="$extra_php_dependencies" -phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +# Create app folders +mkdir -p /home/yunohost.app/$app/upload + +chmod 750 "$datapath" +chmod -R o-rwx "$datapath" +chown -R $app:www-data "$datapath" #================================================= # RESTORE FAIL2BAN CONFIGURATION @@ -102,6 +98,21 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=40 # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=10 + +ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) + +#================================================= +# RESTORE THE NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the NGINX configuration..." + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" + #================================================= # RESTORE THE MYSQL DATABASE #================================================= @@ -111,21 +122,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -#================================================= -# RESTORE THE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Restoring 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="$datapath" --not_mandatory - -# Create app folders -mkdir -p /home/yunohost.app/$app/upload - -chmod 750 "$datapath" -chmod -R o-rwx "$datapath" -chown -R $app:www-data "$datapath" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index b40cddd..73110b7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -18,10 +18,10 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) +language=$(ynh_app_setting_get --app=$app --key=language) admin=$(ynh_app_setting_get --app=$app --key=admin) is_public=$(ynh_app_setting_get --app=$app --key=is_public) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name admin_pwd=$(ynh_app_setting_get --app=$app --key=admin_pwd) @@ -37,6 +37,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # FIX MISSING APP SETTING THAT BREAKS BACKUP #================================================= + # If datapath doesn't exist, create it if [ -z "$datapath" ]; then datapath=/home/yunohost.app/$app @@ -64,6 +65,11 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Ensuring downward compatibility..." +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all +fi + # If db_name doesn't exist, create it if [ -z "$db_name" ]; then db_name=$(ynh_sanitize_dbid --db_name=$app) @@ -102,18 +108,13 @@ then ynh_app_setting_delete --app=$app --key=path_url fi -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all -fi - #================================================= # CREATE DEDICATED USER #================================================= ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -167,14 +168,6 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" -#================================================= -# NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= @@ -188,9 +181,17 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3 # Create a dedicated PHP-FPM config -ynh_add_fpm_config --package="$extra_php_dependencies" +ynh_add_fpm_config phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) +#================================================= +# NGINX CONFIGURATION +#================================================= +ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 + +# Create a dedicated NGINX config +ynh_add_nginx_config + #================================================= # SPECIFIC UPGRADE #=================================================