Browse Source

Set PHP to 7.3

ericgaspar 4 years ago
parent
commit
134f77b6d5
9 changed files with 32 additions and 22 deletions
  1. 3 1
      README.md
  2. 1 1
      conf/nginx.conf
  3. 1 1
      conf/php-fpm.conf
  4. 1 1
      manifest.json
  5. 8 3
      scripts/_common.sh
  6. 5 4
      scripts/backup
  7. 4 4
      scripts/remove
  8. 4 3
      scripts/restore
  9. 5 4
      scripts/upgrade

+ 3 - 1
README.md

@@ -1,4 +1,6 @@
-# VPN Client [![Build Status](https://travis-ci.org/labriqueinternet/vpnclient_ynh.svg?branch=master)](https://travis-ci.org/labriqueinternet/vpnclient_ynh) [![Integration level](https://dash.yunohost.org/integration/vpnclient.svg)](https://dash.yunohost.org/appci/app/vpnclient)
+# VPN Client
+
+[![Build Status](https://travis-ci.org/labriqueinternet/vpnclient_ynh.svg?branch=master)](https://travis-ci.org/labriqueinternet/vpnclient_ynh) [![Integration level](https://dash.yunohost.org/integration/vpnclient.svg)](https://dash.yunohost.org/appci/app/vpnclient)  
 [![Install LaBriqueInterNet VPNclient with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=vpnclient)
 
 This YunoHost app is a part of the "[La Brique Internet](http://labriqueinter.net)" project but can be used independently.

+ 1 - 1
conf/nginx.conf

@@ -35,7 +35,7 @@ location __PATH__/ {
 
   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_read_timeout 600;

+ 1 - 1
conf/php-fpm.conf

@@ -28,7 +28,7 @@
 ;                            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 permissions for unix socket, if one is used. In Linux, read/write
 ; permissions must be set in order to allow connections from a web server. Many

+ 1 - 1
manifest.json

@@ -2,11 +2,11 @@
   "name": "VPN Client",
   "id": "vpnclient",
   "packaging_format": 1,
-  "version": "1.4.1~ynh2",
   "description": {
     "en": "Tunnel the internet traffic through a VPN",
     "fr": "Fait passer le trafic internet à travers un VPN"
   },
+  "version": "1.4.1~ynh3",
   "url": "https://labriqueinter.net",
   "license": "AGPL-3.0",
   "maintainer": {

+ 8 - 3
scripts/_common.sh

@@ -3,11 +3,14 @@
 # Common variables and helpers
 #
 
-pkg_dependencies="php7.0-fpm sipcalc dnsutils openvpn curl fake-hwclock"
+YNH_PHP_VERSION="7.3"
+
+pkg_dependencies="sipcalc dnsutils openvpn curl fake-hwclock"
 
 service_name="ynh-vpnclient"
 service_checker_name=$service_name"-checker"
 
+
 # Operations needed by both 'install' and 'upgrade' scripts
 function vpnclient_deploy_files_and_services()
 {
@@ -61,9 +64,11 @@ function vpnclient_deploy_files_and_services()
   #=================================================
   # PHP-FPM CONFIGURATION
   #=================================================
-  ynh_print_info "Configuring php-fpm..."
+  ynh_print_info "Configuring PHP-FPM..."
 
-  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)
 
   #=================================================
 

+ 5 - 4
scripts/backup

@@ -25,6 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
 
 final_path=$(ynh_app_setting_get $app final_path)
 domain=$(ynh_app_setting_get $app domain)
+phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
 
 #=================================================
 # STANDARD BACKUP STEPS
@@ -53,16 +54,16 @@ ynh_backup "/usr/local/bin/$service_checker_name.sh"
 #=================================================
 # BACKUP THE NGINX CONFIGURATION
 #=================================================
-ynh_print_info "Backing up nginx web server configuration..."
+ynh_print_info "Backing up NGINX web server configuration..."
 
 ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
 
 #=================================================
 # BACKUP THE PHP-FPM CONFIGURATION
 #=================================================
-ynh_print_info "Backing up php-fpm configuration..."
+ynh_print_info "Backing up PHP-FPM configuration..."
 
-ynh_backup "/etc/php/7.0/fpm/pool.d/$app.conf"
+ynh_backup "/etc/php/$phpversion/fpm/pool.d/$app.conf"
 
 #=================================================
 # SPECIFIC BACKUP
@@ -80,4 +81,4 @@ ynh_backup "/etc/systemd/system/openvpn@.service"
 # END OF SCRIPT
 #=================================================
 
-ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
+ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

+ 4 - 4
scripts/remove

@@ -59,17 +59,17 @@ done
 #=================================================
 # REMOVE NGINX CONFIGURATION
 #=================================================
-ynh_print_info "Removing nginx web server configuration"
+ynh_print_info "Removing NGINX web server configuration"
 
-# Remove the dedicated nginx config
+# Remove the dedicated NGINX config
 ynh_remove_nginx_config
 
 #=================================================
 # REMOVE PHP-FPM CONFIGURATION
 #=================================================
-ynh_print_info "Removing php-fpm configuration"
+ynh_print_info "Removing PHP-FPM configuration"
 
-# Remove the dedicated php-fpm config
+# Remove the dedicated PHP-FPM config
 ynh_remove_fpm_config
 
 #=================================================

+ 4 - 3
scripts/restore

@@ -26,6 +26,7 @@ app=$YNH_APP_INSTANCE_NAME
 domain=$(ynh_app_setting_get $app domain)
 path_url=$(ynh_app_setting_get $app path)
 final_path=$(ynh_app_setting_get $app final_path)
+phpversion=$(ynh_app_setting_get $app phpversion)
 
 #=================================================
 # CHECK IF THE APP CAN BE RESTORED
@@ -86,7 +87,7 @@ chown -R $app: $final_path
 # RESTORE THE PHP-FPM CONFIGURATION
 #=================================================
 
-ynh_restore_file "/etc/php/7.0/fpm/pool.d/$app.conf"
+ynh_restore_file "/etc/php/$phpversion/fpm/pool.d/$app.conf"
 
 #=================================================
 # SPECIFIC RESTORATION
@@ -123,9 +124,9 @@ yunohost service add $service_name --description "Tunnels the internet traffic t
 #=================================================
 # RELOAD NGINX AND PHP-FPM
 #=================================================
-ynh_print_info "Reloading nginx web server and php-fpm..."
+ynh_print_info "Reloading NGINX web server and PHP-FPM..."
 
-systemctl reload php7.0-fpm
+systemctl reload php$phpversion-fpm
 systemctl reload nginx
 
 #=================================================

+ 5 - 4
scripts/upgrade

@@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get $app domain)
 path_url=$(ynh_app_setting_get $app path)
 is_public=$(ynh_app_setting_get $app is_public)
 final_path=$(ynh_app_setting_get $app final_path)
+phpversion=$(ynh_app_setting_get $app phpversion)
 
 #=================================================
 # SPECIAL UPGRADE FOR VERSIONS < 1.2.0
@@ -32,10 +33,10 @@ if [ -f /etc/nginx/conf.d/${domain}.d/vpnadmin.conf ]; then
   mv /etc/nginx/conf.d/${domain}.d/vpnadmin.conf /etc/nginx/conf.d/${domain}.d/${app}.conf
 fi
 
-if [ -f /etc/php/7.0/fpm/pool.d/vpnadmin.conf ]; then
-  ynh_replace_string "/var/www/vpnadmin/" "/var/www/${app}/" /etc/php/7.0/fpm/pool.d/vpnadmin.conf
-  ynh_replace_string "vpnadmin.sock" "${app}.sock"  /etc/php/7.0/fpm/pool.d/vpnadmin.conf
-  mv /etc/php/7.0/fpm/pool.d/vpnadmin.conf /etc/php/7.0/fpm/pool.d/${app}.conf
+if [ -f /etc/php/$phpversion/fpm/pool.d/vpnadmin.conf ]; then
+  ynh_replace_string "/var/www/vpnadmin/" "/var/www/${app}/" /etc/php/$phpversion/fpm/pool.d/vpnadmin.conf
+  ynh_replace_string "vpnadmin.sock" "${app}.sock"  /etc/php/$phpversion/fpm/pool.d/vpnadmin.conf
+  mv /etc/php/$phpversion/fpm/pool.d/vpnadmin.conf /etc/php/$phpversion/fpm/pool.d/${app}.conf
 fi
 
 if [ -d /var/www/vpnadmin ]; then