Changeset 3395401
- Timestamp:
- 11/13/2025 11:28:11 PM (5 months ago)
- Location:
- fuerte-wp/trunk
- Files:
-
- 4 edited
-
README.txt (modified) (1 diff)
-
fuerte-wp.php (modified) (3 diffs)
-
includes/class-fuerte-wp-activator.php (modified) (2 diffs)
-
includes/class-fuerte-wp-enforcer.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
fuerte-wp/trunk/README.txt
r3395378 r3395401 2 2 Contributors: tcattd 3 3 Tags: security, login, protection, admin, brute-force, GDPR, privacy, access-control, multisite 4 Stable tag: 1.7. 14 Stable tag: 1.7.2 5 5 Requires at least: 6.0 6 6 Tested up to: 6.9 -
fuerte-wp/trunk/fuerte-wp.php
r3395378 r3395401 6 6 * Plugin URI: https://github.com/EstebanForge/Fuerte-WP 7 7 * Description: Stronger WP. Limit access to critical WordPress areas, even other for admins. 8 * Version: 1.7. 18 * Version: 1.7.2 9 9 * Author: Esteban Cuevas 10 10 * Author URI: https://actitud.xyz … … 33 33 */ 34 34 define("FUERTEWP_PLUGIN_BASE", plugin_basename(__FILE__)); 35 define("FUERTEWP_VERSION", "1.7. 0");35 define("FUERTEWP_VERSION", "1.7.2"); 36 36 define("FUERTEWP_PATH", realpath(plugin_dir_path(__FILE__)) . "/"); 37 37 define("FUERTEWP_URL", trailingslashit(plugin_dir_url(__FILE__))); … … 215 215 216 216 /** 217 * Hook into plugin updates to clear configuration cache. 218 * This ensures that the super users and other configuration are properly 219 * refreshed when the plugin is updated. 220 * 221 * @since 1.7.1 222 */ 223 add_action('upgrader_process_complete', 'fuertewp_handle_plugin_update', 10, 2); 224 225 function fuertewp_handle_plugin_update($upgrader_object, $options) { 226 // Check if this is a plugin update and if it's our plugin 227 if ($options['action'] === 'update' && $options['type'] === 'plugin') { 228 if (isset($options['plugins'])) { 229 foreach ($options['plugins'] as $plugin) { 230 if ($plugin === plugin_basename(FUERTEWP_PLUGIN_BASE)) { 231 // This is our plugin being updated - clear the cache 232 require_once FUERTEWP_PATH . 'includes/class-fuerte-wp-activator.php'; 233 Fuerte_Wp_Activator::handle_plugin_update(); 234 break; 235 } 236 } 237 } 238 } 239 } 240 241 /** 217 242 * htaccess security rules 218 243 */ -
fuerte-wp/trunk/includes/class-fuerte-wp-activator.php
r3395378 r3395401 41 41 public static function activate() 42 42 { 43 // Check if this is a plugin update and clear cache if version changed 44 self::handle_plugin_update(); 45 43 46 self::create_login_security_tables(); 44 47 self::schedule_cron_jobs(); 45 48 self::setup_initial_super_user(); 46 delete_transient('fuertewp_cache_config');47 49 } 48 50 … … 157 159 } 158 160 } 161 162 /** 163 * Handle plugin updates and clear configuration cache when needed. 164 * 165 * @since 1.7.1 166 */ 167 public static function handle_plugin_update() 168 { 169 $option_name = 'fuertewp_version'; 170 $current_version = defined('FUERTEWP_VERSION') ? FUERTEWP_VERSION : '1.0.0'; 171 $previous_version = get_option($option_name, '1.0.0'); 172 173 // If version has changed, clear all relevant caches 174 if ($previous_version !== $current_version) { 175 // Clear the configuration cache 176 delete_transient('fuertewp_cache_config'); 177 178 // Clear the new simple config cache if class exists 179 if (class_exists('Fuerte_Wp_Config')) { 180 Fuerte_Wp_Config::invalidate_cache(); 181 } 182 183 // Clear any other plugin-related transients 184 delete_transient('fuertewp_login_attempts_cache'); 185 delete_transient('fuertewp_ip_whitelist_cache'); 186 187 // Update the stored version 188 update_option($option_name, $current_version); 189 190 // Log the version update for debugging 191 if (function_exists('Fuerte_Wp_Logger') && class_exists('Fuerte_Wp_Logger')) { 192 $logger = new Fuerte_Wp_Logger(); 193 $logger->log("Plugin updated from {$previous_version} to {$current_version} - caches cleared"); 194 } 195 } 196 } 159 197 } -
fuerte-wp/trunk/includes/class-fuerte-wp-enforcer.php
r3395378 r3395401 92 92 93 93 if (!empty($file_config['super_users'])) { 94 // Import super users from file to database 95 $first_super_user = reset($file_config['super_users']); 96 carbon_set_theme_option('fuertewp_super_users', $first_super_user); 97 Fuerte_Wp_Logger::info('Super users imported from file: ' . $first_super_user); 94 // Import super users from file to database as array to match multiselect field 95 carbon_set_theme_option('fuertewp_super_users', $file_config['super_users']); 96 Fuerte_Wp_Logger::info('Super users imported from file: ' . implode(', ', $file_config['super_users'])); 98 97 return; 99 98 } … … 103 102 $current_user = wp_get_current_user(); 104 103 if ($current_user && $current_user->ID > 0 && current_user_can('manage_options')) { 105 // Store as string for backward compatibility106 carbon_set_theme_option('fuertewp_super_users', $current_user->user_email);104 // Store as array to match the multiselect field type 105 carbon_set_theme_option('fuertewp_super_users', [$current_user->user_email]); 107 106 108 107 // Also set plugin status if not already set using Carbon Fields … … 557 556 if (function_exists('carbon_get_theme_option')) { 558 557 $options['fuertewp_status'] = carbon_get_theme_option('fuertewp_status'); 559 $options['super_users'] = carbon_get_theme_option('fuertewp_super_users'); 558 // Get super users from Carbon Fields (where self-healing stores them) 559 $super_users = carbon_get_theme_option('fuertewp_super_users'); 560 561 // Normalize to array format for consistency 562 if (is_string($super_users) && !empty($super_users)) { 563 $options['super_users'] = [$super_users]; 564 } elseif (is_array($super_users)) { 565 $options['super_users'] = $super_users; 566 } else { 567 $options['super_users'] = []; 568 } 560 569 $options['fuertewp_access_denied_message'] = carbon_get_theme_option('fuertewp_access_denied_message'); 561 570 $options['fuertewp_recovery_email'] = carbon_get_theme_option('fuertewp_recovery_email');
Note: See TracChangeset
for help on using the changeset viewer.