1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/wordpress_ynh.git synced 2024-09-03 20:36:10 +02:00

Merge pull request #78 from YunoHost-Apps/replace_wp-fail2ban

Replace wp fail2ban
This commit is contained in:
Maniack Crudelis 2020-01-02 12:06:58 +01:00 committed by GitHub
commit e7194ed971
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 8 deletions

View file

@ -17,7 +17,6 @@
upgrade=1 from_commit=cbb74263e33deb0ec36f99886a2f773e36d40fd9
backup_restore=1
multi_instance=1
incorrect_path=1
port_already_use=0
change_url=1
;; Test avec multisite
@ -37,7 +36,6 @@
upgrade=1
backup_restore=1
multi_instance=1
incorrect_path=0
port_already_use=0
change_url=0
;;; Levels

View file

@ -35,6 +35,23 @@ then
ynh_die --message="https://codex.wordpress.org/Moving_WordPress#Moving_WordPress_Multisite"
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=5
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ACTIVATE MAINTENANCE MODE
#=================================================

View file

@ -167,7 +167,7 @@ wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path"
$wpcli_alias plugin install simple-ldap-login
$wpcli_alias plugin install http-authentication
$wpcli_alias plugin install companion-auto-update
$wpcli_alias plugin install wp-fail2ban
$wpcli_alias plugin install wp-fail2ban-redux
#=================================================
# SET LANGUAGE
@ -210,7 +210,7 @@ ynh_script_progression --message="Activating plugins..." --weight=4
$wpcli_alias plugin activate simple-ldap-login $plugin_network
# Do not activate http-authentication, this plugin is sometimes unstable
$wpcli_alias plugin activate companion-auto-update $plugin_network
$wpcli_alias plugin activate wp-fail2ban $plugin_network
$wpcli_alias plugin activate wp-fail2ban-redux $plugin_network
#=================================================
# STORE THE CONFIG FILE CHECKSUM

View file

@ -83,6 +83,12 @@ if grep add_filter.*auto_update $final_path/wp-config.php; then
sed --in-place '/add_filter.*auto_update/d' $final_path/wp-config.php
fi
# Replace wp-fail2ban by wp-fail2ban-redux
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path"
$wpcli_alias plugin is-installed wp-fail2ban && $wpcli_alias plugin deactivate wp-fail2ban && $wpcli_alias plugin uninstall wp-fail2ban
$wpcli_alias plugin is-installed wp-fail2ban-redux || $wpcli_alias plugin install wp-fail2ban-redux
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -179,8 +185,8 @@ ynh_app_setting_set --app=$app --key=multisite --value=$multisite
#=================================================
ynh_script_progression --message="Updating plugins" --weight=11
wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path"
# wget -nv https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -O $final_path/wp-cli.phar
# wpcli_alias="php $final_path/wp-cli.phar --allow-root --path=$final_path"
update_plugin () {
( $wpcli_alias plugin is-installed $1 && $wpcli_alias plugin update $1 ) || $wpcli_alias plugin install $1
}
@ -188,8 +194,8 @@ update_plugin simple-ldap-login
$wpcli_alias plugin activate simple-ldap-login $plugin_network
update_plugin companion-auto-update
$wpcli_alias plugin activate companion-auto-update $plugin_network
update_plugin wp-fail2ban
$wpcli_alias plugin activate wp-fail2ban $plugin_network
update_plugin wp-fail2ban-redux
$wpcli_alias plugin activate wp-fail2ban-redux $plugin_network
# Disable broken plugin http-authentication
$wpcli_alias plugin is-installed http-authentication && $wpcli_alias plugin deactivate http-authentication $plugin_network