mirror of
https://github.com/YunoHost-Apps/nextcloud_ynh.git
synced 2024-09-03 19:55:57 +02:00
Rename variable to YNH_PHP_VERSION
This commit is contained in:
parent
5310fd9f3a
commit
fb3559ea4a
9 changed files with 25 additions and 27 deletions
|
@ -83,7 +83,7 @@ location ^~ __PATH__/ {
|
|||
fastcgi_param modHeadersAvailable true;
|
||||
# Enable pretty urls
|
||||
fastcgi_param front_controller_active true;
|
||||
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__NAME__.sock;
|
||||
fastcgi_pass unix:/var/run/php/php__YNH_PHP_VERSION__-fpm-__NAME__.sock;
|
||||
fastcgi_intercept_errors on;
|
||||
fastcgi_request_buffering off;
|
||||
fastcgi_param REMOTE_USER $remote_user;
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
|
||||
pkg_dependencies="imagemagick acl tar smbclient at"
|
||||
|
||||
php_version="7.2"
|
||||
extra_pkg_dependencies="php${php_version}-bz2 php${php_version}-imap php${php_version}-smbclient php${php_version}-gmp php${php_version}-gd php${php_version}-json php${php_version}-intl php${php_version}-curl php${php_version}-apcu php${php_version}-redis php${php_version}-ldap php${php_version}-imagick php${php_version}-zip php${php_version}-mbstring php${php_version}-xml php${php_version}-mysql"
|
||||
YNH_PHP_VERSION="7.3"
|
||||
extra_pkg_dependencies="php${YNH_PHP_VERSION}-bz2 php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-smbclient php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-imagick php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysql"
|
||||
|
||||
#=================================================
|
||||
# EXPERIMENTAL HELPERS
|
||||
|
@ -332,7 +332,7 @@ ynh_smart_mktemp () {
|
|||
elif is_there_enough_space /var; then
|
||||
local tmpdir=/var
|
||||
elif is_there_enough_space /; then
|
||||
local tmpdir=/
|
||||
local tmpdir=/
|
||||
elif is_there_enough_space /home; then
|
||||
local tmpdir=/home
|
||||
else
|
||||
|
|
|
@ -43,7 +43,7 @@ ynh_add_fpm_config () {
|
|||
fi
|
||||
|
||||
# Configure PHP-FPM 7.0 by default
|
||||
phpversion="${phpversion:-7.0}"
|
||||
phpversion="${phpversion:-$YNH_PHP_VERSION}"
|
||||
|
||||
local fpm_config_dir="/etc/php/$phpversion/fpm"
|
||||
local fpm_service="php${phpversion}-fpm"
|
||||
|
@ -75,7 +75,7 @@ ynh_add_fpm_config () {
|
|||
|
||||
# Replace standard variables into the default file
|
||||
ynh_replace_string --match_string="^\[www\]" --replace_string="[$app]" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*listen = .*" --replace_string="listen = /var/run/php/php7.0-fpm-$app.sock" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*listen = .*" --replace_string="listen = /var/run/php/php$phpversion-fpm-$app.sock" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string="^user = .*" --replace_string="user = $app" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string="^group = .*" --replace_string="group = $app" --target_file="$finalphpconf"
|
||||
ynh_replace_string --match_string=".*chdir = .*" --replace_string="chdir = $final_path" --target_file="$finalphpconf"
|
||||
|
|
|
@ -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_backup --src_path="/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
ynh_backup --src_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
|
|
|
@ -63,7 +63,7 @@ then
|
|||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config php_version
|
||||
ynh_add_nginx_config YNH_PHP_VERSION
|
||||
fi
|
||||
|
||||
# Change the domain for nginx
|
||||
|
@ -84,7 +84,7 @@ ynh_script_progression --message="Applying Nextcloud specific modifications..."
|
|||
# Define a function to execute commands with `occ`
|
||||
exec_occ() {
|
||||
(cd "$final_path" && exec_as "$app" \
|
||||
php${php_version} occ --no-interaction --no-ansi "$@")
|
||||
php${YNH_PHP_VERSION} occ --no-interaction --no-ansi "$@")
|
||||
}
|
||||
|
||||
if [ $change_domain -eq 1 ]
|
||||
|
|
|
@ -58,7 +58,7 @@ ynh_script_progression --message="Installing dependencies..." --weight=60
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies"
|
||||
ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
|
@ -102,7 +102,7 @@ then
|
|||
fi
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config php_version
|
||||
ynh_add_nginx_config YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -118,7 +118,7 @@ ynh_system_user_create --username=$app
|
|||
ynh_script_progression --message="Configuring php-fpm..." --weight=2
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --phpversion="$php_version"
|
||||
ynh_add_fpm_config --usage=medium --footprint=high
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
|
@ -139,7 +139,7 @@ ynh_script_progression --message="Installing nextcloud..." --weight=30
|
|||
# Define a function to execute commands with `occ`
|
||||
exec_occ() {
|
||||
(cd "$final_path" && exec_as "$app" \
|
||||
php$php_version occ --no-interaction --no-ansi "$@")
|
||||
php$YNH_PHP_VERSION occ --no-interaction --no-ansi "$@")
|
||||
}
|
||||
|
||||
# Set write access for the following commands
|
||||
|
@ -275,7 +275,7 @@ exec_occ background:cron
|
|||
# POST-INSTALL MAINTENANCE
|
||||
#=================================================
|
||||
|
||||
(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${php_version} occ db:add-missing-indices ; sudo -u $app php${php_version} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log")
|
||||
(cd /tmp ; at now + 10 minutes <<< "(cd $final_path ; sudo -u $app php${YNH_PHP_VERSION} occ db:add-missing-indices ; sudo -u $app php${YNH_PHP_VERSION} occ db:convert-filecache-bigint -n) > /tmp/${app}_maintenance.log")
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE THE HOOK FILE FOR USER CREATE
|
||||
|
|
|
@ -30,8 +30,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=20
|
|||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
ynh_remove_php
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
source _ynh_add_fpm_config
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
|
@ -83,7 +84,7 @@ ynh_system_user_create --username=$app
|
|||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
||||
ynh_restore_file --origin_path="/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||
ynh_restore_file --origin_path="/etc/php/$YNH_PHP_VERSION/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
|
@ -95,7 +96,7 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=60
|
|||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies"
|
||||
ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE CRON FILE
|
||||
|
@ -171,7 +172,7 @@ ynh_systemd_action --action=restart --service_name=fail2ban
|
|||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server and php-fpm..."
|
||||
|
||||
ynh_systemd_action --service_name=php7.0-fpm --action=reload
|
||||
ynh_systemd_action --service_name=php${YNH_PHP_VERSION}-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -139,8 +139,7 @@ ynh_script_progression --message="Upgrading dependencies..." --weight=7
|
|||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
ynh_remove_php
|
||||
ynh_install_php --phpversion="$php_version" --package="$extra_pkg_dependencies"
|
||||
ynh_install_php --phpversion="$YNH_PHP_VERSION" --package="$extra_pkg_dependencies"
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
|
@ -152,7 +151,7 @@ ynh_script_progression --message="Upgrading nginx web server configuration..." -
|
|||
ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
# Delete current nginx configuration to be able to check if .well-known is already served.
|
||||
ynh_remove_nginx_config
|
||||
ynh_remove_nginx_config $YNH_PHP_VERSION
|
||||
ynh_app_setting_delete --app=$app --key="checksum__etc_nginx_conf.d_$domain.d_$app.conf"
|
||||
|
||||
# Check if .well-known is available for this domain
|
||||
|
@ -165,7 +164,7 @@ then
|
|||
fi
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config php_version
|
||||
ynh_add_nginx_config YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
|
@ -181,11 +180,11 @@ ynh_system_user_create --username=$app
|
|||
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --phpversion="$php_version"
|
||||
ynh_add_fpm_config --phpversion="$YNH_PHP_VERSION" --usage=medium --footprint=high
|
||||
|
||||
# Delete existing ini configuration file (backward compatibility)
|
||||
if [ -f /etc/php/$php_version/fpm/conf.d/20-$app.ini ]; then
|
||||
ynh_secure_remove --file=/etc/php/$php_version/fpm/conf.d/20-$app.ini
|
||||
if [ -f /etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini ]; then
|
||||
ynh_secure_remove --file=/etc/php/$YNH_PHP_VERSION/fpm/conf.d/20-$app.ini
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -198,7 +197,7 @@ fi
|
|||
# Define a function to execute commands with `occ`
|
||||
exec_occ() {
|
||||
(cd "$final_path" && exec_as "$app" \
|
||||
php$php_version occ --no-interaction --no-ansi "$@")
|
||||
php$YNH_PHP_VERSION occ --no-interaction --no-ansi "$@")
|
||||
}
|
||||
|
||||
# Define a function to add an external storage
|
||||
|
|
Loading…
Add table
Reference in a new issue