diff --git a/check_process b/check_process index 414c6e4..4c603f4 100644 --- a/check_process +++ b/check_process @@ -15,7 +15,8 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=89bf310b8ac87a61e5974508f2b41fbb32823e95 + # 7 + # upgrade=1 from_commit=89bf310b8ac87a61e5974508f2b41fbb32823e95 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/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/scripts/_common.sh b/scripts/_common.sh index 4a718ad..e861e4b 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" +extra_pkg_dependencies="php7.3-fpm php7.3-cli php7.3-gd php7.3-mysql php7.3-xml php7.3-ldap php7.3-mbstring" #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 09fec26..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 @@ -67,6 +67,7 @@ ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= # BACKUP A CRON FILE #================================================= +ynh_print_info --message="Backing up a cron file..." ynh_backup --src_path="/etc/cron.d/$app" 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 7aa4977..1e7287a 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 #================================================= @@ -97,13 +108,6 @@ ynh_print_info --message="Configuring system user..." # Create a system user ynh_system_user_create --username=$app --home_dir="$final_path" -#================================================= -# INSTALL PHP 7.2 -#================================================= -ynh_print_info --message="Installing PHP 7.2..." - -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" - #================================================= # SPECIFIC SETUP #================================================= @@ -120,13 +124,13 @@ mkdir -p "$final_path" 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,10 +152,10 @@ ynh_print_info --message="Installing Drupal..." 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 drupal-7 --drupal-project-rename=$app + sudo -u $app env PATH=$PATH drush pm-download -y drupal-7 --drupal-project-rename=$app popd sudo -u $app env PATH=$PATH drush @$app site-install $install_profil --account-name=$admin --account-pass=$password --account-mail=$admin_mail --db-url=mysql://$db_user:$db_pwd@localhost/$db_name --site-name="$app" --locale=$language --yes @@ -173,7 +177,7 @@ update-alternatives --set php /usr/bin/php7.0 #================================================= # SETUP THE CRON FILE #================================================= -ynh_print_info --message="Setuping the cron file" +ynh_print_info --message="Setuping the cron file..." cp ../conf/cron /etc/cron.d/$app @@ -196,7 +200,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 90f721b..e7d634b 100644 --- a/scripts/remove +++ b/scripts/remove @@ -19,7 +19,6 @@ ynh_print_info --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) -port=$(ynh_app_setting_get --app=$app --key=port) db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) @@ -34,6 +33,14 @@ ynh_print_info --message="Removing the MySQL database..." # Remove a database if it exists, along with the associated user ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name +#================================================= +# REMOVE PHP +#================================================= + +if [ "$(lsb_release --codename --short)" != "buster" ]; then + ynh_print_info --message="Removing php..." + ynh_remove_php +fi #================================================= # REMOVE DEPENDENCIES #================================================= @@ -76,13 +83,6 @@ ynh_print_info --message="Removing the cron file..." # Remove a cron file ynh_secure_remove --file="/etc/cron.d/$app" -#================================================= -# REMOVE PHP -#================================================= -ynh_print_info --message="Removing php..." - -ynh_remove_php - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 5587e14..0504029 100644 --- a/scripts/restore +++ b/scripts/restore @@ -78,22 +78,19 @@ ynh_print_info --message="Restoring user rights..." # Restore permissions on app files chown -R $app: $final_path -#================================================= -# REINSTALL PHP -#================================================= -ynh_print_info --message="Reinstalling php..." - -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" - -#================================================= -# RESTORE THE PHP-FPM CONFIGURATION -#================================================= -ynh_print_info --message="Restoring PHP-FPM configuration..." - -ynh_restore_file --origin_path="/etc/php/7.2/fpm/pool.d/$app.conf" - #================================================= # 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 #================================================= @@ -111,6 +108,13 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +ynh_print_info --message="Restoring PHP-FPM configuration..." + +ynh_restore_file --origin_path="/etc/php/7.3/fpm/pool.d/$app.conf" + #================================================= # RESTORE THE CRON FILE #================================================= @@ -124,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 c13793b..93ea9e9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -84,6 +84,24 @@ 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 #================================================= @@ -99,20 +117,13 @@ ynh_print_info --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) ynh_system_user_create --username=$app --home_dir="$final_path" -#================================================= -# UPGRADE PHP -#================================================= -ynh_print_info --message="Upgrading PHP..." - -ynh_install_php --phpversion="7.2" --package="$extra_pkg_dependencies" - #================================================= # PHP-FPM CONFIGURATION #================================================= 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 @@ -121,7 +132,7 @@ ynh_add_fpm_config --phpversion="7.2" #================================================= 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 @@ -131,16 +142,14 @@ 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 -sudo -u $app env PATH=$PATH drush @$app vset --exact maintenance_mode 0 sudo -u $app env PATH=$PATH drush @$app cache-clear all sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh sudo -u $app env PATH=$PATH drush @$app l10n-update - +sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0 update-alternatives --set php /usr/bin/php7.0 #================================================= @@ -161,7 +170,7 @@ 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="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app" -ynh_systemd_action --service_name=cron --action=restart +ynh_systemd_action --service_name=cron --action=reload #================================================= # GENERIC FINALIZATION