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

Merge pull request #102 from YunoHost-Apps/enh_update_5.0.2

Upgrade to upstream version 5.0.2 / Use PHP 7.3
This commit is contained in:
Éric Gaspar 2020-10-04 10:02:13 +02:00 committed by GitHub
commit 8692177821
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 57 additions and 39 deletions

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://files.phpmyadmin.net/phpMyAdmin/4.9.5/phpMyAdmin-4.9.5-all-languages.tar.gz SOURCE_URL=https://files.phpmyadmin.net/phpMyAdmin/5.0.2/phpMyAdmin-5.0.2-all-languages.tar.gz
SOURCE_SUM=d1ab98cde370c39dafdaa13ce02fa35cecaaa6d33553fde092604b99660e8835 SOURCE_SUM=8d5cb67de154262b6e51e6ac6967d0931d28ef39cdc7fbec44011d374eb432ae
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true

View file

@ -16,7 +16,7 @@ location __PATH__/ {
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;
location ~ [^/]\.php(/|$) { location ~ [^/]\.php(/|$) {
fastcgi_split_path_info ^(.+?\.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; fastcgi_index index.php;
include fastcgi_params; include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user; fastcgi_param REMOTE_USER $remote_user;

View file

@ -33,7 +33,7 @@ group = __USER__
; (IPv6 and IPv4-mapped) on a specific port; ; (IPv6 and IPv4-mapped) on a specific port;
; '/path/to/unix/socket' - to listen on a unix socket. ; '/path/to/unix/socket' - to listen on a unix socket.
; Note: This value is mandatory. ; 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. ; Set listen(2) backlog.
; Default Value: 511 (-1 on FreeBSD and OpenBSD) ; Default Value: 511 (-1 on FreeBSD and OpenBSD)

View file

@ -6,7 +6,7 @@
"en": "Manage MySQL databases over the web", "en": "Manage MySQL databases over the web",
"fr": "Application web de gestion des bases de données MySQL" "fr": "Application web de gestion des bases de données MySQL"
}, },
"version": "4.9.5~ynh1", "version": "5.0.2~ynh1",
"url": "http://www.phpmyadmin.net", "url": "http://www.phpmyadmin.net",
"license": "GPL-2.0-only", "license": "GPL-2.0-only",
"maintainer": { "maintainer": {
@ -14,7 +14,7 @@
"email": "julien.malik@paraiso.me" "email": "julien.malik@paraiso.me"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.5.0" "yunohost": ">= 3.8.1"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [

View file

@ -1,12 +1,20 @@
#!/bin/bash #!/bin/bash
#=================================================
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="7.3"
extra_php_dependencies="php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mbstring"
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
# Execute a command as another user # Execute a command as another user
# usage: exec_as USER COMMAND [ARG ...] # usage: exec_as USER COMMAND [ARG ...]
exec_as() { ynh_exec_as() {
local USER=$1 local USER=$1
shift 1 shift 1
@ -19,7 +27,8 @@ exec_as() {
# Execute a command with Composer # Execute a command with Composer
# #
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands" # usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
# | 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: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute. # | arg: -c, --commands - Commands to execute.
ynh_composer_exec () { ynh_composer_exec () {
@ -32,7 +41,7 @@ ynh_composer_exec () {
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}" workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}" phpversion="${phpversion:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \ COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \ php${phpversion} "$workdir/composer.phar" $commands \
@ -41,18 +50,22 @@ ynh_composer_exec () {
# Install and initialize Composer in the given directory # Install and initialize Composer in the given directory
# #
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path] # usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"]
# | 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: -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
ynh_install_composer () { ynh_install_composer () {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=vw local legacy_args=vwa
declare -Ar args_array=( [v]=phpversion= [w]=workdir= ) declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args=)
local phpversion local phpversion
local workdir local workdir
local install_args
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}" workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.0}" phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
curl -sS https://getcomposer.org/installer \ curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \ | COMPOSER_HOME="$workdir/.composer" \
@ -60,6 +73,6 @@ ynh_install_composer () {
|| ynh_die "Unable to install Composer." || ynh_die "Unable to install Composer."
# update dependencies to create composer.lock # update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \ ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer." || ynh_die "Unable to update core dependencies with Composer."
} }

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
# source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -48,7 +48,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
ynh_script_progression --message="Backing up 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/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP THE MYSQL DATABASE # BACKUP THE MYSQL DATABASE

View file

@ -101,7 +101,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Configuring php-fpm..." --weight=2 ynh_script_progression --message="Configuring php-fpm..." --weight=2
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS # IMPORT GENERIC HELPERS
#================================================= #=================================================
# source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -95,16 +95,21 @@ chown $app: $final_path/tmp
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_restore_file --origin_path="/etc/php/7.0/fpm/pool.d/$app.conf" ynh_script_progression --message="Reconfiguring php-fpm..." --weight=6
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION --package="$extra_php_dependencies"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." ynh_script_progression --message="Reloading nginx web server..."
ynh_systemd_action --service_name=php7.0-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -128,7 +128,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=4 ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=4
# Create a dedicated php-fpm config # Create a dedicated php-fpm config
ynh_add_fpm_config ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --package="$extra_php_dependencies"
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
@ -176,22 +176,6 @@ cp ../conf/config.inc.php $final_path
# Recalculate and store the config file checksum into the app settings # Recalculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$final_path/config.inc.php" ynh_store_file_checksum --file="$final_path/config.inc.php"
#=================================================
# INSTALL DEPENDENCIES
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading dependencies with Composer..." --weight=19
# Install composer
ynh_install_composer
# Install dependencies
ynh_exec_warn_less ynh_composer_exec --commands=\"update --no-dev\"
fi
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -207,6 +191,22 @@ chmod 640 $final_path/config.inc.php
mkdir -p $final_path/tmp mkdir -p $final_path/tmp
chown -R $app: $final_path/tmp chown -R $app: $final_path/tmp
#=================================================
# INSTALL DEPENDENCIES
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading dependencies with Composer..." --weight=19
# Force dependency to the used PHP version
ynh_exec_warn_less ynh_composer_exec --commands=\"config -g platform.php $YNH_PHP_VERSION\"
# Install dependencies
ynh_exec_warn_less ynh_composer_exec --commands=\"update --no-dev\"
fi
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================