From caf9cbf0b681d5c90485ce07956241c561693740 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 4 Nov 2020 23:27:34 +0100 Subject: [PATCH] PHP7.3 --- README.md | 2 +- conf/cron | 2 +- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- issue_template.md | 6 ++--- manifest.json | 4 ++-- scripts/_common.sh | 4 +++- scripts/backup | 3 ++- scripts/change_url | 22 +++++++---------- scripts/install | 60 ++++++++++++++++++++++++---------------------- scripts/remove | 8 +++---- scripts/restore | 9 +++---- scripts/upgrade | 50 +++++++++++++++++++------------------- 13 files changed, 88 insertions(+), 86 deletions(-) diff --git a/README.md b/README.md index 4f5c327..b895994 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ LDAP and HTTP auth are supported through plugins - Ticket Closer - Ticket Rewriter -* The package includes many languages available through `Admin Panel > Settings > System +* The package includes many languages available through `Admin Panel > Settings > System` ## Links diff --git a/conf/cron b/conf/cron index b89531a..9df5ffc 100644 --- a/conf/cron +++ b/conf/cron @@ -1 +1 @@ -*/5 * * * * nobody php __FINALPATH__/api/cron.php \ No newline at end of file +*/5 * * * * nobody php__PHPVERSION__ __FINALPATH__/api/cron.php \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 901ac24..556b622 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -17,7 +17,7 @@ location __PATH__/ { try_files $uri $uri/ index.php; 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; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index ab5dca9..ab1a471 100644 --- a/conf/php-fpm.conf +++ b/conf/php-fpm.conf @@ -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) diff --git a/issue_template.md b/issue_template.md index 9f271c6..b45c1c3 100644 --- a/issue_template.md +++ b/issue_template.md @@ -7,7 +7,7 @@ about: Create a report to help us debug, it would be nice to fill the template a **How to post a meaningful bug report** 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!* + - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - *Otherwise, the issue may be due to osticket itself. Refer to its documentation or repository for help.* - *If you have a doubt, post here, we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* @@ -34,8 +34,8 @@ about: Create a report to help us debug, it would be nice to fill the template a - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* 1. *Go to '...'* - 2. *Click on '....'* - 3. *Scroll down to '....'* + 2. *Click on '...'* + 3. *Scroll down to '...'* 4. *See error* **Expected behavior** diff --git a/manifest.json b/manifest.json index c349269..633006d 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 3.8.1" }, "multi_instance": true, "services": [ @@ -67,7 +67,7 @@ "en": "Choose the application language", "fr": "Choisissez la langue de l'application" }, - "choices": ["en_US","fr","ar_EG","ar_SA","az","bg","bn","bs","ca","cs","da","de","el","en_GB","es_AR","es_ES","es_MX","et","eu","fa","fi","he","hi","hr","hu","id","is","it","ja","ka","km","ko","lt","lv","mk","mn","ms","nl","no","pl","pt_BR","pt_PT","ro","ru","sk","sl","sq","sr","sr_CS","sv_SE","sw","th","tr","uk","ur_IN","ur_PK","vi","zh_CN","zh_TW"], + "choices": ["fr","en_GB"], "default": "fr" }, { diff --git a/scripts/_common.sh b/scripts/_common.sh index c1ae9c8..6e85e9e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,10 @@ # COMMON VARIABLES #================================================= +YNH_PHP_VERSION="7.3" + # dependencies used by the app -pkg_dependencies="php-gd php-gettext php-imap php-json php-mbstring php-xml php-zip php-intl php-apcu php-curl" +pkg_dependencies="php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gettext php${YNH_PHP_VERSION}-imap php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-apcu php${YNH_PHP_VERSION}-curl" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 7170751..22bf24f 100644 --- a/scripts/backup +++ b/scripts/backup @@ -31,6 +31,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -53,7 +54,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" # BACKUP THE 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" #================================================= # SPECIFIC BACKUP diff --git a/scripts/change_url b/scripts/change_url index 0856ea5..f49845b 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -38,7 +38,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_print_info --message="Backing up the app before changing its url (may take a while)..." +ynh_print_info --message="Backing up the app before changing its URL (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -73,23 +73,23 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_print_info --message="Updating nginx web server configuration..." +ynh_print_info --message="Updating NGINX web server configuration..." 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 + # 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 @@ -99,18 +99,12 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - #================================================= # GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_print_info --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index fdc3b5d..4be4500 100644 --- a/scripts/install +++ b/scripts/install @@ -99,9 +99,9 @@ ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Configuring nginx web server..." +ynh_print_info --message="Configuring NGINX web server..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -115,10 +115,11 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info --message="Configuring php-fpm..." +ynh_print_info --message="Configuring PHP-FPM..." -# 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) #================================================= # SPECIFIC SETUP @@ -143,24 +144,24 @@ mkdir -p "$final_path/include/plugins/build/.config/composer" COMPOSER_HOME="$final_path/include/plugins/build/.config/composer" pushd "$final_path/include/plugins/build" - php make.php hydrate - php -dphar.readonly=0 make.php build auth-cas - php -dphar.readonly=0 make.php build auth-ldap - php -dphar.readonly=0 make.php build auth-oauth - php -dphar.readonly=0 make.php build auth-passthru - php -dphar.readonly=0 make.php build storage-fs - php -dphar.readonly=0 make.php build storage-s3 - php -dphar.readonly=0 make.php build archiver - php -dphar.readonly=0 make.php build attachment_preview - php -dphar.readonly=0 make.php build autocloser - php -dphar.readonly=0 make.php build fetch-note - php -dphar.readonly=0 make.php build field-radiobuttons - php -dphar.readonly=0 make.php build fwd-rewriter - php -dphar.readonly=0 make.php build mattermost - php -dphar.readonly=0 make.php build mentioner - php -dphar.readonly=0 make.php build microsoft-teams - php -dphar.readonly=0 make.php build slack - php -dphar.readonly=0 make.php build preventautoscroll + php$phpversion make.php hydrate + php$phpversion -dphar.readonly=0 make.php build auth-cas + php$phpversion -dphar.readonly=0 make.php build auth-ldap + php$phpversion -dphar.readonly=0 make.php build auth-oauth + php$phpversion -dphar.readonly=0 make.php build auth-passthru + php$phpversion -dphar.readonly=0 make.php build storage-fs + php$phpversion -dphar.readonly=0 make.php build storage-s3 + php$phpversion -dphar.readonly=0 make.php build archiver + php$phpversion -dphar.readonly=0 make.php build attachment_preview + php$phpversion -dphar.readonly=0 make.php build autocloser + php$phpversion -dphar.readonly=0 make.php build fetch-note + php$phpversion -dphar.readonly=0 make.php build field-radiobuttons + php$phpversion -dphar.readonly=0 make.php build fwd-rewriter + php$phpversion -dphar.readonly=0 make.php build mattermost + php$phpversion -dphar.readonly=0 make.php build mentioner + php$phpversion -dphar.readonly=0 make.php build microsoft-teams + php$phpversion -dphar.readonly=0 make.php build slack + php$phpversion -dphar.readonly=0 make.php build preventautoscroll cp *.phar $final_path/include/plugins/. popd ynh_secure_remove --file="$final_path/include/plugins/build" @@ -175,21 +176,21 @@ rsync -a "../conf/i18n" "$final_path/include/." #================================================= # SETUP APPLICATION WITH CURL #================================================= -ynh_print_info --message="Setuping application with CURL..." +ynh_print_info --message="Setuping application with cURL..." -# Set right permissions for curl install +# Set right permissions for cURL install chown -R $app: $final_path -# Set the app as temporarily public for curl call +# Set the app as temporarily public for cURL call ynh_print_info --message="Configuring SSOwat..." ynh_app_setting_set --app=$app --key=skipped_uris --value="/" # Reload SSOwat config yunohost app ssowatconf -# Reload Nginx +# Reload NGINX ynh_systemd_action --service_name=nginx --action=reload -# Installation with curl +# Installation with cURL ynh_print_info --message="Finalizing installation..." ynh_local_curl "/setup/install.php" "s=install" "name=$app" "email=$app@$domain" "lang_id=$language" "fname=$admin_fname" "lname=$admin_lname" "admin_email=$admin_mail" "username=$admin" "passwd=$password" "passwd2=$password" "prefix=ost_" "dbhost=localhost" "dbname=$db_name" "dbuser=$db_user" "dbpass=$db_pwd" @@ -218,6 +219,7 @@ ynh_print_info --message="Setting the cron file..." cp ../conf/cron /etc/cron.d/$app ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -252,7 +254,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_print_info --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index edb4a04..3700f08 100644 --- a/scripts/remove +++ b/scripts/remove @@ -50,17 +50,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Removing nginx web server configuration..." +ynh_print_info --message="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 --message="Removing php-fpm configuration..." +ynh_print_info --message="Removing PHP-FPM configuration..." -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= diff --git a/scripts/restore b/scripts/restore index cecd22d..0720373 100644 --- a/scripts/restore +++ b/scripts/restore @@ -33,6 +33,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -49,7 +50,7 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_print_info --message="Restoring the nginx configuration..." +ynh_print_info --message="Restoring the NGINX configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -81,7 +82,7 @@ chown -R $app: $final_path #================================================= ynh_print_info --message="Restoring PHP-FPM configuration..." -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" #================================================= # SPECIFIC RESTORATION @@ -114,9 +115,9 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_print_info --message="Reloading nginx web server and php-fpm..." +ynh_print_info --message="Reloading NGINX web server and PHP-FPM..." -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 #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 74dc963..05d8c6a 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ 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) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) config_file=$final_path/include/ost-config.php @@ -113,9 +114,9 @@ fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_print_info --message="Upgrading nginx web server configuration..." +ynh_print_info --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -136,10 +137,10 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_print_info --message="Upgrading php-fpm configuration..." +ynh_print_info --message="Upgrading PHP-FPM configuration..." -# Create a dedicated php-fpm config -ynh_add_fpm_config +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --phpversion=$YNH_PHP_VERSION #================================================= # SPECIFIC UPGRADE @@ -153,24 +154,24 @@ then mkdir -p "$final_path/include/plugins/build/.config/composer" COMPOSER_HOME="$final_path/include/plugins/build/.config/composer" pushd "$final_path/include/plugins/build" - php make.php hydrate - php -dphar.readonly=0 make.php build auth-cas - php -dphar.readonly=0 make.php build auth-ldap - php -dphar.readonly=0 make.php build auth-oauth - php -dphar.readonly=0 make.php build auth-passthru - php -dphar.readonly=0 make.php build storage-fs - php -dphar.readonly=0 make.php build storage-s3 - php -dphar.readonly=0 make.php build archiver - php -dphar.readonly=0 make.php build attachment_preview - php -dphar.readonly=0 make.php build autocloser - php -dphar.readonly=0 make.php build fetch-note - php -dphar.readonly=0 make.php build field-radiobuttons - php -dphar.readonly=0 make.php build fwd-rewriter - php -dphar.readonly=0 make.php build mattermost - php -dphar.readonly=0 make.php build mentioner - php -dphar.readonly=0 make.php build microsoft-teams - php -dphar.readonly=0 make.php build slack - php -dphar.readonly=0 make.php build preventautoscroll + php$phpversion make.php hydrate + php$phpversion -dphar.readonly=0 make.php build auth-cas + php$phpversion -dphar.readonly=0 make.php build auth-ldap + php$phpversion -dphar.readonly=0 make.php build auth-oauth + php$phpversion -dphar.readonly=0 make.php build auth-passthru + php$phpversion -dphar.readonly=0 make.php build storage-fs + php$phpversion -dphar.readonly=0 make.php build storage-s3 + php$phpversion -dphar.readonly=0 make.php build archiver + php$phpversion -dphar.readonly=0 make.php build attachment_preview + php$phpversion -dphar.readonly=0 make.php build autocloser + php$phpversion -dphar.readonly=0 make.php build fetch-note + php$phpversion -dphar.readonly=0 make.php build field-radiobuttons + php$phpversion -dphar.readonly=0 make.php build fwd-rewriter + php$phpversion -dphar.readonly=0 make.php build mattermost + php$phpversion -dphar.readonly=0 make.php build mentioner + php$phpversion -dphar.readonly=0 make.php build microsoft-teams + php$phpversion -dphar.readonly=0 make.php build slack + php$phpversion -dphar.readonly=0 make.php build preventautoscroll cp -f *.phar $final_path/include/plugins/. popd ynh_secure_remove --file="$final_path/include/plugins/build" @@ -205,6 +206,7 @@ ynh_print_info --message="Setting the cron file..." cp -f ../conf/cron /etc/cron.d/$app ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app" +ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -240,7 +242,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_print_info --message="Reloading nginx web server..." +ynh_print_info --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload