From cd7b5a31414c53adf1f81e5ad77e2201cdae7ae8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 28 Mar 2020 21:44:10 +0100 Subject: [PATCH] Upgrade to PHP7.3 --- README.md | 2 +- README_fr.md | 2 +- check_process | 3 ++- conf/civicrm-drupal.src | 4 +-- conf/civicrm-l10n.src | 4 +-- conf/nginx.conf | 2 +- conf/php-fpm.conf | 2 +- manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/backup | 2 +- scripts/change_url | 11 +++++---- scripts/install | 54 ++++++++++++++++++++++------------------- scripts/remove | 9 ++++++- scripts/restore | 16 +++++++++--- scripts/upgrade | 30 +++++++++++++++++------ 15 files changed, 91 insertions(+), 54 deletions(-) diff --git a/README.md b/README.md index d72ebe0..f9ac72f 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to ## Overview Open source constituent relationship management (CRM) for non-profits, NGOs and advocacy organizations. -**Shipped version:** 5.21.0 on Drupal 7 +**Shipped version:** 5.23.4 on Drupal 7 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 4a6ff35..8fa0d16 100644 --- a/README_fr.md +++ b/README_fr.md @@ -11,7 +11,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour ## Vue d'ensemble Gestion des relations avec les constituants (GRC/CRM) pour les organisations à but non lucratif, les ONG et les organisations de défense des droits. -**Version incluse:** 5.21.0 et Drupal 7 +**Version incluse:** 5.23.4 et Drupal 7 ## Captures d'écran diff --git a/check_process b/check_process index 2eac283..5541af2 100644 --- a/check_process +++ b/check_process @@ -15,7 +15,8 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=b90ed18d3309d1124171a02934c4d0ae9b53a087 + # 7 + # upgrade=1 from_commit=b90ed18d3309d1124171a02934c4d0ae9b53a087 backup_restore=1 multi_instance=1 # This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version. diff --git a/conf/civicrm-drupal.src b/conf/civicrm-drupal.src index eba16f2..a6cc25e 100644 --- a/conf/civicrm-drupal.src +++ b/conf/civicrm-drupal.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://storage.googleapis.com/civicrm/civicrm-stable/5.21.0/civicrm-5.21.0-drupal.tar.gz -SOURCE_SUM=0662b2df0d9bd0896203f9aeccf39c76e0d6dc2e877a7db6d245d61d96c259bc +SOURCE_URL=https://storage.googleapis.com/civicrm/civicrm-stable/5.23.4/civicrm-5.23.4-drupal.tar.gz +SOURCE_SUM=922295851446e3ffcb5d19fcea6fe4a2f0db2d4d7248a10a6dc786d9ed3473cf SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/civicrm-l10n.src b/conf/civicrm-l10n.src index ee82516..158ae69 100644 --- a/conf/civicrm-l10n.src +++ b/conf/civicrm-l10n.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://storage.googleapis.com/civicrm/civicrm-stable/5.21.0/civicrm-5.21.0-l10n.tar.gz -SOURCE_SUM=789d74298818896eafa026f8438925b37826ce58c594868adaba12323b76043a +SOURCE_URL=https://storage.googleapis.com/civicrm/civicrm-stable/5.23.4/civicrm-5.23.4-l10n.tar.gz +SOURCE_SUM=c11697fe346c312c474529625cbea2c36a39f41bd7204d7626862d9ee8937179 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/nginx.conf b/conf/nginx.conf index 93d374c..dd58121 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -58,7 +58,7 @@ location __PATH__/ { location ~ '[^/]\.php$|^/update.php' { fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php7.2-fpm-__NAME__.sock; + fastcgi_pass unix:/var/run/php/php7.3-fpm-__NAME__.sock; fastcgi_index index.php; include fastcgi_params; diff --git a/conf/php-fpm.conf b/conf/php-fpm.conf index a7b230f..4b682a3 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.2-fpm-__NAMETOCHANGE__.sock +listen = /var/run/php/php7.3-fpm-__NAMETOCHANGE__.sock ; Set listen(2) backlog. ; Default Value: 511 (-1 on FreeBSD and OpenBSD) diff --git a/manifest.json b/manifest.json index 870d214..881c938 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "CRM for non-profits, NGOs and advocacy organizations.", "fr": "CRM pour organisations à but non lucratif et ONG." }, - "version": "5.21.0-7.0~ynh1", + "version": "5.23.4-7.0~ynh1", "url": "https://civicrm.org", "license": "AGPL-3.0-or-later", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 0f40897..eb68cc0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,7 @@ # dependencies used by the app pkg_dependencies="curl libzip-dev" -extra_pkg_dependencies="php7.2-fpm php7.2-cli php7.2-gd php7.2-mysql php7.2-xml php7.2-ldap php7.2-mbstring php7.2-uploadprogress php7.2-curl php7.2-soap" +extra_pkg_dependencies="php7.3-fpm php7.3-cli php7.3-gd php7.3-mysql php7.3-xml php7.3-ldap php7.3-mbstring php7.3-uploadprogress php7.3-curl php7.3-soap" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 015da10..688b099 100644 --- a/scripts/backup +++ b/scripts/backup @@ -53,7 +53,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_print_info --message="Backing up php-fpm configuration..." -ynh_backup --src_path="/etc/php/7.2/fpm/pool.d/$app.conf" +ynh_backup --src_path="/etc/php/7.3/fpm/pool.d/$app.conf" #================================================= # BACKUP THE MYSQL DATABASE diff --git a/scripts/change_url b/scripts/change_url index 865a9f7..4d2a1b6 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -106,12 +106,13 @@ fi #================================================= ynh_print_info --message="Updating Drush alias..." -cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php" +drush_aliasconfig="$final_path/.drush/$app.aliases.drushrc.php" +cp -f "../conf/yoursite.aliases.drushrc.php" "$drush_aliasconfig" -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$new_domain" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__PATH_URL__" --replace_string="$new_path" --target_file="$drush_aliasconfig" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 830a1ab..16cb9c8 100644 --- a/scripts/install +++ b/scripts/install @@ -35,7 +35,7 @@ is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE password=$YNH_APP_ARG_PASSWORD install_profil=$YNH_APP_ARG_INSTALL_PROFIL -admin_mail=$(ynh_user_get_info --username=$admin --key="mail") +admin_mail=$(ynh_user_get_info --username=$admin --key=mail) app=$YNH_APP_INSTANCE_NAME @@ -64,6 +64,17 @@ ynh_app_setting_set --app=$app --key=install_profil --value=$install_profil #================================================= # STANDARD MODIFICATIONS +#================================================= +# INSTALL PHP7.3 +#================================================= + +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + ynh_print_info --message="Installing PHP7.3..." + ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies" +fi + #================================================= # INSTALL DEPENDENCIES #================================================= @@ -71,13 +82,6 @@ ynh_print_info --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies -#================================================= -# INSTALL PHP -#================================================= -ynh_print_info --message="Installing PHP..." - -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" - #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -88,14 +92,6 @@ db_user=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name -#================================================= -# CREATE FINAL PATH -#================================================= -ynh_print_info --message="Creating final path..." - -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -mkdir -p "$final_path" - #================================================= # NGINX CONFIGURATION #================================================= @@ -114,19 +110,27 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # SPECIFIC SETUP +#================================================= +# CREATE FINAL PATH +#================================================= +ynh_print_info --message="Creating final path..." + +ynh_app_setting_set --app=$app --key=final_path --value=$final_path +mkdir -p "$final_path" + #================================================= # CREATE DRUSH ALIAS #================================================= ynh_print_info --message="Creating Drush alias..." mkdir -p "$final_path/.drush" +drush_aliasconfig="$final_path/.drush/$app.aliases.drushrc.php" +cp -f "../conf/yoursite.aliases.drushrc.php" "$drush_aliasconfig" -cp -f "../conf/yoursite.aliases.drushrc.php" "$final_path/.drush/$app.aliases.drushrc.php" - -ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.drush/$app.aliases.drushrc.php" -ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$final_path/.drush/$app.aliases.drushrc.php" +ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$drush_aliasconfig" +ynh_replace_string --match_string="__PATH_URL__" --replace_string="$path_url" --target_file="$drush_aliasconfig" #================================================= # INSTALL COMPOSER @@ -137,7 +141,7 @@ mkdir -p "$final_path/.composer" cp -f "../conf/composer.json" "$final_path/.composer/composer.json" -ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer" +ynh_install_composer --phpversion="7.3" --workdir="$final_path/.composer" export PATH="$final_path/.composer/vendor/bin:$PATH" @@ -148,7 +152,7 @@ ynh_print_info --message="Installing Drupal and CiviCRM..." chown -R $app: $final_path -update-alternatives --set php /usr/bin/php7.2 +update-alternatives --set php /usr/bin/php7.3 pushd "$final_path" sudo -u $app env PATH=$PATH drush pm-download -y drupal-7 --drupal-project-rename=$app @@ -204,7 +208,7 @@ ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php" ynh_print_info --message="Configuring php-fpm..." # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion="7.2" +ynh_add_fpm_config --phpversion="7.3" #================================================= # SECURE FILES AND DIRECTORIES diff --git a/scripts/remove b/scripts/remove index 6fcaa13..ba3f673 100644 --- a/scripts/remove +++ b/scripts/remove @@ -42,6 +42,14 @@ ynh_print_info --message="Removing php-fpm configuration..." # Remove the dedicated php-fpm config ynh_remove_fpm_config +#================================================= +# REMOVE PHP +#================================================= + +if [ "$(lsb_release --codename --short)" != "buster" ]; then + ynh_print_info --message="Removing php..." + ynh_remove_php +fi #================================================= # REMOVE DEPENDENCIES #================================================= @@ -49,7 +57,6 @@ ynh_print_info --message="Removing dependencies..." # Remove metapackage and its dependencies ynh_remove_app_dependencies -ynh_remove_php #================================================= # REMOVE APP MAIN DIR diff --git a/scripts/restore b/scripts/restore index 818f2cb..0504029 100644 --- a/scripts/restore +++ b/scripts/restore @@ -80,6 +80,17 @@ chown -R $app: $final_path #================================================= # SPECIFIC RESTORATION +#================================================= +# REINSTALL PHP7.3 +#================================================= + +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + ynh_print_info --message="Reinstalling PHP7.3..." + ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies" +fi + #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -87,7 +98,6 @@ ynh_print_info --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" #================================================= # RESTORE THE MYSQL DATABASE @@ -103,7 +113,7 @@ ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./ #================================================= ynh_print_info --message="Restoring PHP-FPM configuration..." -ynh_restore_file --origin_path="/etc/php/7.2/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/7.3/fpm/pool.d/$app.conf" #================================================= # RESTORE THE CRON FILE @@ -118,7 +128,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= ynh_print_info --message="Reloading nginx web server and php-fpm..." -ynh_systemd_action --service_name=php7.2-fpm --action=reload +ynh_systemd_action --service_name=php7.3-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4bddd3f..ae097d7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,13 +84,30 @@ ynh_print_info --message="Upgrading nginx web server configuration..." # Create a dedicated nginx config ynh_add_nginx_config +#================================================= +# UPGRADE PHP7.3 +#================================================= + +if [ "$(lsb_release --codename --short)" = "buster" ]; then + pkg_dependencies="$pkg_dependencies $extra_pkg_dependencies" +else + if [ "$(ynh_app_setting_get --app=$app --key=php_version)" != "7.3" ]; then + ynh_print_info --message="Upgrading PHP7.3..." + ynh_remove_fpm_config + ynh_remove_app_dependencies + ynh_remove_php + ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies" + else + ynh_install_php --phpversion="7.3" --package="$extra_pkg_dependencies" + fi +fi + #================================================= # UPGRADE DEPENDENCIES #================================================= ynh_print_info --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" #================================================= # CREATE DEDICATED USER @@ -106,7 +123,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path" ynh_print_info --message="Upgrading php-fpm configuration..." # Create a dedicated php-fpm config -ynh_add_fpm_config --phpversion="7.2" +ynh_add_fpm_config --phpversion="7.3" #================================================= # SPECIFIC UPGRADE @@ -124,7 +141,7 @@ ynh_systemd_action --service_name=mysql --action="restart" #================================================= ynh_print_info --message="Upgrading Composer..." -ynh_install_composer --phpversion="7.2" --workdir="$final_path/.composer" +ynh_install_composer --phpversion="7.3" --workdir="$final_path/.composer" #================================================= # UPGRADE DRUPAL @@ -134,8 +151,7 @@ ynh_print_info --message="Upgrading Drupal..." ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php" export PATH="$final_path/.composer/vendor/bin:$PATH" -update-alternatives --set php /usr/bin/php7.2 - +update-alternatives --set php /usr/bin/php7.3 sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1 sudo -u $app env PATH=$PATH drush @$app cache-clear all sudo -u $app env PATH=$PATH drush @$app pm-update -y drupal @@ -145,11 +161,9 @@ sudo -u $app env PATH=$PATH drush @$app l10n-update ynh_setup_source --dest_dir="$final_path/$app/sites/all/modules/civicrm" --source_id="civicrm-drupal" ynh_setup_source --dest_dir="$final_path/$app/sites/all/modules/civicrm" --source_id="civicrm-l10n" - sudo -u $app env PATH=$PATH drush --include="$final_path/$app/sites/all/modules/civicrm/drupal/drush" @$app -y civicrm-upgrade-db -sudo -u $app env PATH=$PATH drush @$app vset --exact maintenance_mode 0 - +sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0 update-alternatives --set php /usr/bin/php7.0 #=================================================