1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/roundcube_ynh.git synced 2024-09-03 20:16:28 +02:00

Add suport for PHP7.3

This commit is contained in:
ericgaspar 2020-11-02 17:47:49 +01:00
parent 90c00e4d77
commit 166ae0ae41
No known key found for this signature in database
GPG key ID: 574F281483054D44
8 changed files with 37 additions and 22 deletions

View file

@ -39,6 +39,7 @@ location __PATH__/favicon.ico {
location ~ ^__PATH__/(config|temp|logs)/ { location ~ ^__PATH__/(config|temp|logs)/ {
deny all; deny all;
} }
location ~ ^__PATH__/(.+/|)\. { location ~ ^__PATH__/(.+/|)\. {
deny all; deny all;
} }

View file

@ -7,7 +7,7 @@
YNH_PHP_VERSION="7.3" YNH_PHP_VERSION="7.3"
# Package dependencies # Package dependencies
extra_php_dependencies="php-cli php-common php-intl php-json php-pear php-auth-sasl php-mail-mime php-patchwork-utf8 php-net-smtp php-net-socket php-zip php-gd php-mbstring php-curl" extra_php_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-common php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-pear php${YNH_PHP_VERSION}-auth-sasl php${YNH_PHP_VERSION}-mail-mime php${YNH_PHP_VERSION}-patchwork-utf8 php${YNH_PHP_VERSION}-net-smtp php${YNH_PHP_VERSION}-net-socket php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-curl"
# Plugins version # Plugins version
contextmenu_version=2.3 contextmenu_version=2.3
@ -18,9 +18,15 @@ carddav_version=3.0.3
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================
readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
# Declare the actual composer version to use.
# A packager willing to use another version of composer can override the variable into its _common.sh.
YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION}
# Execute a command with Composer # Execute a command with Composer
# #
# usage: ynh_composer_exec --phpversion=phpversion [--workdir=$final_path] --commands="commands" # usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. # | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -c, --commands - Commands to execute. # | arg: -c, --commands - Commands to execute.
ynh_composer_exec () { ynh_composer_exec () {
@ -33,7 +39,7 @@ ynh_composer_exec () {
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}" workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.3}" phpversion="${phpversion:-$YNH_PHP_VERSION}"
COMPOSER_HOME="$workdir/.composer" \ COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \ php${phpversion} "$workdir/composer.phar" $commands \
@ -42,25 +48,33 @@ ynh_composer_exec () {
# Install and initialize Composer in the given directory # Install and initialize Composer in the given directory
# #
# usage: ynh_install_composer --phpversion=phpversion [--workdir=$final_path] # usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion]
# | arg: -v, --phpversion - PHP version to use with composer
# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. # | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path.
# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include
# | arg: -c, --composerversion - Composer version to install
ynh_install_composer () { ynh_install_composer () {
# Declare an array to define the options of this helper. # Declare an array to define the options of this helper.
local legacy_args=vw local legacy_args=vwa
declare -Ar args_array=( [v]=phpversion= [w]=workdir= ) declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=)
local phpversion local phpversion
local workdir local workdir
local install_args
local composerversion
# Manage arguments with getopts # Manage arguments with getopts
ynh_handle_getopts_args "$@" ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}" workdir="${workdir:-$final_path}"
phpversion="${phpversion:-7.3}" phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
composerversion="${composerversion:-$YNH_COMPOSER_VERSION}"
curl -sS https://getcomposer.org/installer \ curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \ | COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --quiet --install-dir="$workdir" \ php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \
|| ynh_die "Unable to install Composer." || ynh_die "Unable to install Composer."
# update dependencies to create composer.lock # update dependencies to create composer.lock
ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev" \ ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \
|| ynh_die "Unable to update core dependencies with Composer." || ynh_die "Unable to update core dependencies with Composer."
} }

View file

@ -62,4 +62,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_print_info --message="Backup script completed for Roundcube. (YunoHost will then actually copy those files to the archive)." ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -89,4 +89,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Change of URL completed for Roundcube" --last ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -117,7 +117,7 @@ ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name
#================================================= #=================================================
# CONFIGURE ROUNDCUBE # CONFIGURE ROUNDCUBE
#================================================= #=================================================
ynh_script_progression --message="Configuring Roundcube..." ynh_script_progression --message="Configuring $app..."
rc_conf="$final_path/config/config.inc.php" rc_conf="$final_path/config/config.inc.php"
@ -232,4 +232,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of Roundcube completed" --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -41,7 +41,7 @@ ynh_mysql_remove_db --db_user=$db_name --db_name=$db_name
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing Roundcube main directory..." --weight=3 ynh_script_progression --message="Removing $app main directory..." --weight=3
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
@ -76,4 +76,4 @@ ynh_system_user_delete --username=$app
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Removal of Roundcube completed" --last ynh_script_progression --message="Removal of $app completed" --last

View file

@ -50,7 +50,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring Roundcube main directory..." ynh_script_progression --message="Restoring $app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
@ -104,4 +104,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Restoration completed for Roundcube" --last ynh_script_progression --message="Restoration completed for $app" --last

View file

@ -72,7 +72,7 @@ fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
ynh_script_progression --message="Backing up Roundcube before upgrading (may take a while)..." --weight=30 ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=30
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -152,7 +152,7 @@ then
ynh_replace_string --match_string="__DBUSER__" --replace_string=$db_name --target_file="$rc_conf" ynh_replace_string --match_string="__DBUSER__" --replace_string=$db_name --target_file="$rc_conf"
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$rc_conf" ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$rc_conf"
ynh_replace_string --match_string="__DBNAME__" --replace_string=$db_name --target_file="$rc_conf" ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$rc_conf"
#================================================= #=================================================
# UPDATE DEPENDENCIES WITH COMPOSER # UPDATE DEPENDENCIES WITH COMPOSER
@ -241,7 +241,7 @@ then
#================================================= #=================================================
# UPDATE ROUNDCUBE CONFIGURATION # UPDATE ROUNDCUBE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Updating Roundcube configuration..." --weight=4 ynh_script_progression --message="Updating $app configuration..." --weight=4
ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$rc_conf" ynh_replace_string --match_string="^\s*// installed plugins" --replace_string="&\n $installed_plugins" --target_file="$rc_conf"
@ -255,7 +255,7 @@ then
#================================================= #=================================================
# UPDATE ROUNDCUBE CORE # UPDATE ROUNDCUBE CORE
#================================================= #=================================================
ynh_script_progression --message="Updating Roundcube core..." --weight=4 ynh_script_progression --message="Updating $app core..." --weight=4
( cd "$final_path" ( cd "$final_path"
ynh_exec_warn ./bin/update.sh --version=$oldversion -y) ynh_exec_warn ./bin/update.sh --version=$oldversion -y)
@ -283,4 +283,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of Roundcube completed" --last ynh_script_progression --message="Installation of $app completed" --last