From d3d5980b015127781a671af667ff49945abdd87a Mon Sep 17 00:00:00 2001 From: Kevin Date: Sun, 23 Jun 2024 22:33:39 +0200 Subject: [PATCH] v 0.96.0 - Fix behavior when updating a plugin with lang files. - Check if 2FA is installed for admins. --- bin/update.sh | 1 - tools/diagnostic/inc/40-wordpress.php | 17 ++++++++++++++++- wputools.sh | 2 +- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bin/update.sh b/bin/update.sh index 25c360a..c54aa0d 100644 --- a/bin/update.sh +++ b/bin/update.sh @@ -271,7 +271,6 @@ function wputools__update_plugin() { if [[ "${_PLUGIN_VERSION_OLD}" == "${_PLUGIN_VERSION}" ]];then local _PLUGIN_COMMIT_TEXT="Update Plugin ${_PLUGIN_TITLE}"; fi; - git add "${_PLUGIN_LANG}"; if [[ -d "${_PLUGIN_LANG}" ]];then git add "${_PLUGIN_LANG}"; fi; diff --git a/tools/diagnostic/inc/40-wordpress.php b/tools/diagnostic/inc/40-wordpress.php index 083ca83..5386a3d 100644 --- a/tools/diagnostic/inc/40-wordpress.php +++ b/tools/diagnostic/inc/40-wordpress.php @@ -382,7 +382,7 @@ function wputools_test_rss_feed($rss_url) { } /* ---------------------------------------------------------- - Check number of admins + Check admins ---------------------------------------------------------- */ $admins = get_users(array( @@ -390,6 +390,21 @@ function wputools_test_rss_feed($rss_url) { 'fields' => array('user_nicename') )); +/* Check 2FA */ +if (!$is_debug_env) { + if (!in_array('two-factor/two-factor.php', get_option('active_plugins'))) { + $wputools_errors[] = 'You should have an active 2FA plugin.'; + } else { + foreach ($admins as $user) { + $two_fa_user = get_user_meta($user->ID, '_two_factor_enabled', true); + if (!$two_fa_user) { + $wputools_errors[] = sprintf('You should have 2FA enabled for the user ā€œ%sā€.', $user->user_nicename); + } + } + } +} + +/* Check user name */ if (count($admins) > 1) { $admins = array_map(function ($c) { return $c->user_nicename; diff --git a/wputools.sh b/wputools.sh index ec1e8b5..e507941 100644 --- a/wputools.sh +++ b/wputools.sh @@ -2,7 +2,7 @@ WPUTools(){ -local _WPUTOOLS_VERSION='0.95.0'; +local _WPUTOOLS_VERSION='0.96.0'; local _PHP_VERSIONS=(7.0 7.1 7.2 7.3 7.4 8.0 8.1 8.2 8.3 8.4 8.5 9.0) local _PHP_VERSIONS_OBSOLETES=(7.0 7.1 7.2 7.3 7.4) local _PHP_VERSIONS_ADVANCED=(8.2 8.3 8.4 8.5 9.0)