1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/piwigo_ynh.git synced 2024-09-03 20:06:03 +02:00
* Upgrade to PHP7.3

Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org>
This commit is contained in:
Éric Gaspar 2020-11-12 18:28:43 +01:00 committed by GitHub
parent 74ce9c3834
commit 09afe78325
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 69 additions and 120 deletions

View file

@ -1,6 +1,6 @@
# Piwigo for YunoHost
[![Integration level](https://dash.yunohost.org/integration/piwigo.svg)](https://dash.yunohost.org/appci/app/piwigo)
[![Integration level](https://dash.yunohost.org/integration/piwigo.svg)](https://dash.yunohost.org/appci/app/piwigo) ![](https://ci-apps.yunohost.org/ci/badges/piwigo.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/piwigo.maintain.svg)
[![Install Piwigo with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=piwigo)
> *This package allow you to install Piwigo quickly and simply on a YunoHost server.
@ -8,18 +8,16 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to
## Overview
[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. Icing on the cake, Piwigo is free and opensource.
[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:** 2.10.2
## Screenshots
![](http://piwigo.org/screenshots/homepage/piwigo-batch-manager.png)
![](sources/screenshot_Piwigo.jpg)
## Demo
* [YunoHost demo](https://demo.yunohost.org/piwigo/)
* [Official demo](http://piwigo.org/demo/)
## Configuration
@ -31,11 +29,9 @@ Extensions make Piwigo easily customizable. Icing on the cake, Piwigo is free an
## YunoHost specific features
In addition to Piwigo core features, the following are made available with
this package:
In addition to Piwigo core features, the following are made available with this package:
* Integrate with YunoHost users and SSO:
* private mode: limit access to Yunohost users
* private mode: limit access to YunoHost users
* public mode:
* SSO for YunoHost users
* allow other users management, and guest mode
@ -43,9 +39,8 @@ this package:
#### Supported architectures
* x86-64b - [![Build Status](https://ci-apps.yunohost.org/ci/logs/piwigo%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/piwigo/)
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/piwigo%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/piwigo/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/piwigo%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/piwigo/)
* Jessie x86-64b - [![Build Status](https://ci-stretch.nohost.me/ci/logs/piwigo%20%28Apps%29.svg)](https://ci-stretch.nohost.me/ci/apps/piwigo/)
## Limitations
@ -60,8 +55,7 @@ this package:
---
Developers infos
----------------
## Developers infos
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/piwigo_ynh/tree/testing).

View file

@ -14,7 +14,7 @@ location __PATH__/ {
default_type text/html;
location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php7.0-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user if_not_empty;

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory.
listen = /var/run/php/php7.0-fpm-__NAMETOCHANGE__.sock
listen = /var/run/php/php__PHPVERSION__-fpm-__NAMETOCHANGE__.sock
; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD)

View file

@ -3,10 +3,10 @@
"id": "piwigo",
"packaging_format": 1,
"description": {
"en": "photo gallery",
"fr": "Galerie photo"
"en": "Open source photo gallery for the web",
"fr": "Galerie de photos open source pour le web"
},
"version": "2.10.2~ynh1",
"version": "2.10.2~ynh2",
"url": "http://piwigo.org",
"license": "GPL-2.0",
"maintainer": {
@ -15,7 +15,7 @@
"url": ""
},
"requirements": {
"yunohost": ">= 3.5.0"
"yunohost": ">= 3.8.1"
},
"multi_instance": true,
"services": [

View file

@ -4,7 +4,9 @@
# COMMON VARIABLES
#=================================================
pkg_dependencies="php-gd php-imagick imagemagick"
YNH_PHP_VERSION="7.3"
pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-imagick imagemagick"
#=================================================
# EXPERIMENTAL HELPERS

View file

@ -1,45 +0,0 @@
#!/bin/bash
# Curl abstraction to help with POST requests to local pages (such as installation forms)
# For multiple calls, cookies are persisted between each call for the same app
#
# $domain and $path_url should be defined externally (and correspond to the domain.tld and the /path (of the app?))
#
# example: ynh_local_curl "/install.php?installButton" "foo=$var1" "bar=$var2"
#
# usage: ynh_local_curl "page_uri" "key1=value1" "key2=value2" ...
# | arg: page_uri - Path (relative to $path_url) of the page where POST data will be sent
# | arg: key1=value1 - (Optionnal) POST key and corresponding value
# | arg: key2=value2 - (Optionnal) Another POST key and corresponding value
# | arg: ... - (Optionnal) More POST keys and values
#
# Requires YunoHost version 2.6.4 or higher.
ynh_local_curl () {
# Define url of page to curl
local local_page=$(ynh_normalize_url_path $1)
local full_path=$path_url$local_page
if [ "${path_url}" == "/" ]; then
full_path=$local_page
fi
local full_page_url=https://localhost$full_path
# Concatenate all other arguments with '&' to prepare POST data
local POST_data=""
local arg=""
for arg in "${@:2}"
do
POST_data="${POST_data}${arg}&"
done
if [ -n "$POST_data" ]
then
# Add --data arg and remove the last character, which is an unecessary '&'
POST_data="--data ${POST_data::-1}"
fi
# Wait untils nginx has fully reloaded (avoid curl fail with http2)
sleep 2
# Curl the URL
curl --silent --show-error -kL -H "Host: $domain" --resolve $domain:443:127.0.0.1 $POST_data "$full_page_url" --cookie-jar /tmp/ynh-$app-cookie.txt --cookie /tmp/ynh-$app-cookie.txt
}

View file

@ -19,58 +19,55 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=2
ynh_print_info --message="Loading installation settings..."
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)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# STANDARD BACKUP STEPS
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Backing up the main app directory..."
ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up nginx web server configuration..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# BACKUP THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up php-fpm configuration..."
ynh_backup --src_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# BACKUP THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Backing up the MySQL database..."
ynh_print_info --message="Backing up the MySQL database..."
ynh_mysql_dump_db --database="$db_name" > db.sql
#=================================================
# BACKUP FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Backing up fail2ban configuration..."
ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Backing up data directory..."
ynh_backup --src_path="/home/yunohost.app/${app}/upload" --is_big
@ -78,4 +75,4 @@ ynh_backup --src_path="/home/yunohost.app/${app}/upload" --is_big
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last
ynh_print_info --message="Backup script completed for Piwigo. (YunoHost will then actually copy those files to the archive)."

View file

@ -50,23 +50,23 @@ fi
#=================================================
# MODIFY URL IN NGINX CONF FILE
#=================================================
ynh_script_progression --message="Updating nginx web server configuration..." --weight=2
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=2
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original nginx config file if modified
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for nginx helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for nginx
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
@ -81,7 +81,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -89,4 +89,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last
ynh_script_progression --message="Change of URL completed for Piwigo" --last

View file

@ -8,7 +8,6 @@
source _common.sh
source /usr/share/yunohost/helpers
source _ynh_local_curl
#=================================================
# MANAGE SCRIPT FAILURE
@ -96,9 +95,9 @@ ynh_system_user_create --username=$app
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring nginx web server..."
ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -136,15 +135,16 @@ ynh_secure_remove --file="$tmpdir"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring php-fpm..." --weight=2
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated php-fpm config
ynh_add_fpm_config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SETUP APPLICATION WITH CURL
#=================================================
ynh_script_progression --message="Installing piwigo with Curl..." --weight=5
ynh_script_progression --message="Installing Piwigo with cURL..." --weight=5
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
# Reload SSOwat config
@ -172,7 +172,7 @@ ynh_local_curl "/install.php?language=$applanguage" "install=true" "dbuser=$db_n
#=================================================
# CONFIGURE PIWIGO
#=================================================
ynh_script_progression --message="Configuring piwigo..."
ynh_script_progression --message="Configuring Piwigo..."
# Change local config
cp ../conf/config.inc.php $final_path/local/config/
@ -219,7 +219,7 @@ UPDATE piwigo_ldap_login_config SET value='0' WHERE param = 'ld_group_user_activ
#=================================================
# CONFIGURE FAIL2BAN
#=================================================
ynh_script_progression --message="Configuring fail2ban..." --weight=6
ynh_script_progression --message="Configuring Fail2Ban..." --weight=6
# Configure and activate log_failed_logins plugin
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< "INSERT INTO plugins (id,state,version) VALUES ('log_failed_logins','active','1.2');"
@ -247,7 +247,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -255,4 +255,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last
ynh_script_progression --message="Installation of Piwigo completed" --last

View file

@ -41,7 +41,7 @@ ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..."
ynh_script_progression --message="Removing Piwigo main directory..."
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
@ -49,23 +49,23 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing nginx web server configuration..." --weight=2
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=2
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing php-fpm configuration..."
ynh_script_progression --message="Removing PHP-FPM configuration..."
# Remove the dedicated php-fpm config
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Removing fail2ban configuration..." --weight=8
ynh_script_progression --message="Removing Fail2Ban configuration..." --weight=8
ynh_remove_fail2ban_config
@ -83,4 +83,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Removal of $app completed" --last
ynh_script_progression --message="Removal of Piwigo completed" --last

View file

@ -28,6 +28,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -50,7 +51,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_script_progression --message="Restoring Piwigo main directory..."
ynh_restore_file --origin_path="$final_path"
@ -74,13 +75,14 @@ ynh_system_user_create --username=$app
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=10
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE FAIL2BAN CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the fail2ban configuration..." --weight=7
ynh_script_progression --message="Restoring the Fail2Ban configuration..." --weight=7
ynh_restore_file "/etc/fail2ban/jail.d/$app.conf"
ynh_restore_file "/etc/fail2ban/filter.d/$app.conf"
@ -98,7 +100,7 @@ ynh_systemd_action --action=restart --service_name=fail2ban
ynh_script_progression --message="Reinstalling dependencies..." --weight=40
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
# RESTORE THE DATA DIRECTORY
@ -109,7 +111,7 @@ ynh_script_progression --message="Restoring data directory..."
ynh_restore_file --origin_path="/home/yunohost.app/$app/upload" --not_mandatory
# Create app folders
mkdir -p "/home/yunohost.app/$app/upload"
mkdir -p /home/yunohost.app/$app/upload
# Create temporary data folder
mkdir -p /home/yunohost.app/$app/_data
@ -126,13 +128,13 @@ chown -R $app: /home/yunohost.app/$app
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=2
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Restoration completed for $app" --last
ynh_script_progression --message="Restoration completed for Piwigo" --last

View file

@ -8,7 +8,6 @@
source _common.sh
source /usr/share/yunohost/helpers
source _ynh_local_curl
#=================================================
# LOAD SETTINGS
@ -78,7 +77,7 @@ fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=6
ynh_script_progression --message="Backing up Piwigo before upgrading (may take a while)..." --weight=6
# Backup the current version of the app
ynh_backup_before_upgrade
@ -119,7 +118,7 @@ fi
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=2
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
# Create a dedicated nginx config
ynh_add_nginx_config
@ -142,9 +141,9 @@ ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=3
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=3
# Create a dedicated php-fpm config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
@ -189,7 +188,7 @@ chmod 755 -R $final_path/_data
#=================================================
# UPGRADE APPLICATION WITH CURL
#=================================================
ynh_script_progression --message="Upgrading piwigo with Curl..." --weight=6
ynh_script_progression --message="Upgrading Piwigo with cURL..." --weight=6
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
# Reload SSOwat config
@ -210,7 +209,7 @@ ynh_local_curl "/upgrade.php?language=$applanguage&now=true" "language=$applangu
#=================================================
# CONFIGURE PIWIGO
#=================================================
ynh_script_progression --message="Configuring piwigo..."
ynh_script_progression --message="Configuring Piwigo..."
# Make a backup of the original config file if modified
ynh_backup_if_checksum_is_different --file="$final_path/local/config/config.inc.php"
@ -269,7 +268,7 @@ fi
#=================================================
# UPGRADE FAIL2BAN
#=================================================
ynh_script_progression --message="Reconfiguring fail2ban..." --weight=8
ynh_script_progression --message="Reconfiguring Fail2Ban..." --weight=8
# Configure and activate log_failed_logins plugin
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< "INSERT INTO plugins (id,state,version) VALUES ('log_failed_logins','active','1.2');" 2>&1 > /dev/null || ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name <<< "UPDATE plugins SET state='active' WHERE id='log_failed_logins';"
@ -297,7 +296,7 @@ fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading nginx web server..."
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
@ -305,4 +304,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Upgrade of $app completed" --last
ynh_script_progression --message="Upgrade of Piwigo completed" --last

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB