1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wordpress_ynh.git synced 2024-09-03 20:36:10 +02:00
This commit is contained in:
Éric Gaspar 2023-04-25 21:26:13 +02:00
parent 3233c0ab18
commit 3732d1cd52
3 changed files with 13 additions and 59 deletions

View file

@ -14,8 +14,6 @@ license = "GPL-2.0"
website = "https://wordpress.org/"
admindoc = "https://codex.wordpress.org/"
code = "https://core.trac.wordpress.org/browser"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 11.1.18"

View file

@ -28,20 +28,14 @@ ynh_maintenance_mode_ON
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
if [ -z "$admin_wordpress" ]; then
if [ -z "${admin:-}" ]; then
ynh_mysql_execute_as_root --sql="select MAX(user_login) from wp_users where user_status=0 INTO OUTFILE '/tmp/wordpressuser';" --database=$db_name
admin_wordpress=$(cat /tmp/wordpressuser)
admin=$(cat /tmp/wordpressuser)
ynh_secure_remove --file=/tmp/wordpressuser
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin_wordpress
ynh_app_setting_set --app=$app --key=admin --value=$admin
fi
# If install_dir doesn't exist, create it
if [ -z "$install_dir" ]; then
#REMOVEME? install_dir=/var/www/$app
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
fi
if [ -z "$language" ]; then
if [ -z "${language:-}" ]; then
language=$(grep WPLANG $install_dir/wp-config.php | cut -d"'" -f4)
ynh_app_setting_set --app=$app --key=language --value=$language
fi
@ -55,51 +49,27 @@ elif [ "${multisite,,}" = "no" ]; then
multisite=0
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If some 'add_filter' are still in wp_config, remove them
if grep add_filter.*auto_update $install_dir/wp-config.php; then
sed --in-place '/add_filter.*auto_update/d' $install_dir/wp-config.php
fi
# If admin_mail_html doesn't exist, create it
if [ -z "$admin_mail_html" ]; then
admin_mail_html=1
#REMOVEME? ynh_app_setting_set --app=$app --key=admin_mail_html --value=$admin_mail_html
fi
# If overwrite_nginx doesn't exist, create it
if [ -z "$overwrite_nginx" ]; then
overwrite_nginx=1
ynh_app_setting_set $app overwrite_nginx $overwrite_nginx
fi
# If overwrite_phpfpm doesn't exist, create it
if [ -z "$overwrite_phpfpm" ]; then
overwrite_phpfpm=1
ynh_app_setting_set --app=$app --key=overwrite_phpfpm --value=$overwrite_phpfpm
fi
# If fpm_footprint doesn't exist, create it
if [ -z "$fpm_footprint" ]; then
if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=medium
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "$fpm_free_footprint" ]; then
if [ -z "${fpm_free_footprint:-}" ]; then
fpm_free_footprint=0
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "$fpm_usage" ]; then
if [ -z "${fpm_usage:-}" ]; then
# If the app is private, set the usage to low, otherwise to high.
#REMOVEME? if [ $(ynh_app_setting_get --app=$app --key=is_public) -eq 0 ]
if [ $(ynh_app_setting_get --app=$app --key=is_public) -eq 0 ]
then
usage=low
else
@ -109,12 +79,6 @@ if [ -z "$fpm_usage" ]; then
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
# If phpversion doesn't exist, create it
if [ -z "$phpversion" ]; then
phpversion=$YNH_PHP_VERSION
ynh_app_setting_set --app=$app --key=phpversion --value=$phpversion
fi
# Replace wp-fail2ban by wp-fail2ban-redux
ynh_exec_warn_less wget --no-verbose https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar --output-document=$install_dir/wp-cli.phar
wpcli_alias="php$phpversion $install_dir/wp-cli.phar --allow-root --path=$install_dir"
@ -131,25 +95,17 @@ $wpcli_alias plugin is-installed simple-ldap-login && $wpcli_alias plugin deacti
#=================================================
# NGINX CONFIGURATION
#=================================================
# Overwrite the NGINX configuration only if it's allowed
if [ $overwrite_nginx -eq 1 ]
then
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2
ynh_add_nginx_config
fi
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
# Overwrite the PHP-FPM configuration only if it's allowed
if [ $overwrite_phpfpm -eq 1 ]
then
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
fi
#=================================================
# SPECIFIC UPGRADE

0
tests.toml Normal file
View file