| @@ -6,9 +6,9 @@ | ||
| 6 | 6 | * Description: AI-powered WordPress assistant for onboarding and ongoing editing offered exclusively through select WordPress hosting providers. |
| 7 | 7 | * Plugin URI: https://extendify.com/?utm_source=wp-plugins&utm_campaign=plugin-uri&utm_medium=wp-dash |
| 8 | 8 | * Author: Extendify |
| 9 | 9 | * Author URI: https://extendify.com/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash |
| 10 | - * Version: 3.1.1 | |
| 10 | + * Version: 3.2.2 | |
| 11 | 11 | * Requires at least: 6.5 |
| 12 | 12 | * Requires PHP: 7.0 |
| 13 | 13 | * License: GPL-2.0-or-later |
| 14 | 14 | * License URI: https://www.gnu.org/licenses/gpl-2.0.html |
| @@ -28,10 +28,8 @@ | ||
| 28 | 28 | // phpcs:enable Generic.Files.LineLength.TooLong |
| 29 | 29 | |
| 30 | 30 | defined('ABSPATH') || exit; |
| 31 | 31 | |
| 32 | -use Extendify\PartnerData; | |
| 33 | - | |
| 34 | 32 | /** ExtendifySdk is the previous class name used */ |
| 35 | 33 | if (!class_exists('ExtendifySdk') && !class_exists('Extendify')) : |
| 36 | 34 | |
| 37 | 35 | /** |
| @@ -80,31 +78,28 @@ | ||
| 80 | 78 | $extendify = new Extendify(); |
| 81 | 79 | $extendify(); |
| 82 | 80 | }); |
| 83 | 81 | |
| 84 | - add_action('update_option', function ($option) { | |
| 85 | - if (in_array($option, ['WPLANG', 'blogname'], true)) { | |
| 86 | - \delete_transient('extendify_recommendations'); | |
| 87 | - \delete_transient('extendify_domains'); | |
| 88 | - \delete_transient('extendify_supportArticles'); | |
| 89 | - } | |
| 82 | + // Autoloaded options load on every request, even while the plugin is inactive. | |
| 83 | + // Before 6.6 there is no 'auto' value, so older sites are left alone. | |
| 84 | + if (function_exists('wp_autoload_values_to_autoload')) { | |
| 85 | + register_deactivation_hook(__FILE__, function () { | |
| 86 | + $names = preg_grep('/^extendify_/', array_keys(wp_load_alloptions())); | |
| 87 | + update_option('extendify_autoload_restore', $names, false); | |
| 88 | + wp_set_option_autoload_values(array_fill_keys($names, false)); | |
| 89 | + }); | |
| 90 | 90 | |
| 91 | - // Delete the partner transient so we can fetch new data when the locale is switched. | |
| 92 | - if (($option === 'WPLANG') && get_transient('extendify_partner_data_cache_check')) { | |
| 93 | - delete_transient('extendify_partner_data_cache_check'); | |
| 94 | - PartnerData::getPartnerData(); | |
| 95 | - } | |
| 96 | - }); | |
| 91 | + register_activation_hook(__FILE__, function () { | |
| 92 | + global $wpdb; | |
| 93 | + // Passing true writes 'on', which skips WordPress's 150KB autoload size check. | |
| 94 | + foreach (get_option('extendify_autoload_restore', []) as $name) { | |
| 95 | + $wpdb->update($wpdb->options, ['autoload' => 'auto'], ['option_name' => $name]); | |
| 96 | + } | |
| 97 | + wp_cache_delete('alloptions', 'options'); | |
| 98 | + delete_option('extendify_autoload_restore'); | |
| 99 | + }); | |
| 100 | + } | |
| 97 | 101 | |
| 98 | - // Delete the partner transient so we can fetch new data when the locale is switched via WP-CLI. | |
| 99 | - add_action('cli_init', function () { | |
| 100 | - $command = sanitize_text_field(wp_unslash(($_SERVER['argv'][1] ?? ''))); | |
| 101 | - if ($command === 'language' && get_transient('extendify_partner_data_cache_check')) { | |
| 102 | - delete_transient('extendify_partner_data_cache_check'); | |
| 103 | - PartnerData::getPartnerData(); | |
| 104 | - } | |
| 105 | - }); | |
| 106 | - | |
| 107 | 102 | // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundBeforeLastUsed |
| 108 | 103 | add_action('upgrader_process_complete', function ($upgrader, $options) { |
| 109 | 104 | $updatedExtendify = isset($options['plugins']) && array_filter($options['plugins'], function ($plugin) { |
| 110 | 105 | return strpos($plugin, 'extendify') !== false; |
| @@ -146,17 +141,8 @@ | ||
| 146 | 141 | wp_safe_redirect(admin_url()); |
| 147 | 142 | exit; |
| 148 | 143 | } |
| 149 | 144 | }); |
| 150 | - | |
| 151 | - // Allow Extendify requests to have a longer timeout. | |
| 152 | - add_filter('http_request_args', function ($args, $url) { | |
| 153 | - if (strpos($url, 'extendify') !== false) { | |
| 154 | - $args['timeout'] = 45; | |
| 155 | - } | |
| 156 | - | |
| 157 | - return $args; | |
| 158 | - }, 100, 2); | |
| 159 | 145 | |
| 160 | 146 | // Clean up the site profile if being accessed |
| 161 | 147 | add_filter('option_extendify_site_profile', function ($value) { |
| 162 | 148 | $profile = is_string($value) ? json_decode($value, true) : $value; |