| @@ -38,20 +38,19 @@ | ||
| 38 | 38 | ), |
| 39 | 39 | '3.7.0' => array('update_370_disable_auto_preload_after_purge_feature'), |
| 40 | 40 | '3.8.0' => array('update_380_404_detector_table_create'), |
| 41 | 41 | '4.3.1' => array( |
| 42 | - 'update_431_update_browser_cache_htaccess_config', | |
| 43 | 42 | 'update_431_db_table_analysis_wipe_usage_data', |
| 44 | 43 | ), |
| 45 | 44 | '4.4.0' => array( |
| 46 | 45 | 'update_440_change_plugin_json_permissions', |
| 47 | 46 | ), |
| 48 | - '4.6.0' => array( | |
| 49 | - 'update_460_update_browser_cache_htaccess_config', | |
| 50 | - ), | |
| 51 | 47 | '4.6.1' => array( |
| 52 | 48 | 'update_461_update_post_meta_keys', |
| 53 | 49 | ), |
| 50 | + '4.7.0' => array( | |
| 51 | + 'update_470_update_browser_cache_htaccess_config', | |
| 52 | + ), | |
| 54 | 53 | ); |
| 55 | 54 | |
| 56 | 55 | /** |
| 57 | 56 | * See if any database schema updates are needed, and perform them if so. |
| @@ -73,8 +72,22 @@ | ||
| 73 | 72 | } |
| 74 | 73 | } |
| 75 | 74 | update_option('wpo_update_version', WPO_VERSION); |
| 76 | 75 | } |
| 76 | + | |
| 77 | + $wpo_version = get_option('wpo_version'); | |
| 78 | + | |
| 79 | + // If the wpo_version option is not set, but the db_version is, we assume that the wpo_version should be set to the db_version. | |
| 80 | + if (!$wpo_version) { | |
| 81 | + $wpo_version = $db_version ?: WPO_VERSION; | |
| 82 | + update_option('wpo_version', $wpo_version); | |
| 83 | + } | |
| 84 | + | |
| 85 | + if ($wpo_version && version_compare($our_version, $wpo_version, '!=')) { | |
| 86 | + update_option('wpo_version', WPO_VERSION); | |
| 87 | + // Trigger the activation actions to ensure that any necessary setup is performed when the version changes. | |
| 88 | + WPO_Activation::silence_activation_actions(); | |
| 89 | + } | |
| 77 | 90 | } |
| 78 | 91 | |
| 79 | 92 | /** |
| 80 | 93 | * Delete old semaphore locks from options database table. |
| @@ -352,18 +365,8 @@ | ||
| 352 | 365 | WP_Optimize()->get_table_management()->create_plugin_tables(); |
| 353 | 366 | } |
| 354 | 367 | |
| 355 | 368 | /** |
| 356 | - * Update the browser cache htaccess config file with max-age values | |
| 357 | - */ | |
| 358 | - private static function update_431_update_browser_cache_htaccess_config() { | |
| 359 | - if (self::is_new_install()) return; | |
| 360 | - if (!WP_Optimize()->get_options()->get_option('enable_browser_cache')) return; | |
| 361 | - | |
| 362 | - WP_Optimize()->get_browser_cache()->restore(); | |
| 363 | - } | |
| 364 | - | |
| 365 | - /** | |
| 366 | 369 | * Wipe WPO_DB_Table_Analysis usage data |
| 367 | 370 | */ |
| 368 | 371 | private static function update_431_db_table_analysis_wipe_usage_data() { |
| 369 | 372 | if (self::is_new_install()) return; |
| @@ -382,18 +385,8 @@ | ||
| 382 | 385 | WP_Optimize()->get_db_info()->change_plugin_json_permissions(); |
| 383 | 386 | } |
| 384 | 387 | |
| 385 | 388 | /** |
| 386 | - * Update the browser cache htaccess config file with fix disabling cache for php files and /wp-admin/ dir | |
| 387 | - */ | |
| 388 | - private static function update_460_update_browser_cache_htaccess_config() { | |
| 389 | - if (self::is_new_install()) return; | |
| 390 | - if (!WP_Optimize()->get_options()->get_option('enable_browser_cache')) return; | |
| 391 | - | |
| 392 | - WP_Optimize()->get_browser_cache()->restore(); | |
| 393 | - } | |
| 394 | - | |
| 395 | - /** | |
| 396 | 389 | * Prefix WPO specific post meta keys with `_` to make it private. |
| 397 | 390 | */ |
| 398 | 391 | private static function update_461_update_post_meta_keys() { |
| 399 | 392 | if (self::is_new_install()) return; |
| @@ -419,8 +412,9 @@ | ||
| 419 | 412 | self::update_461_convert_post_meta_keys($keys_to_convert); |
| 420 | 413 | } |
| 421 | 414 | |
| 422 | 415 | } |
| 416 | + | |
| 423 | 417 | /** |
| 424 | 418 | * Perform the post meta key renaming for the current blog. |
| 425 | 419 | * |
| 426 | 420 | * @param array $keys_to_convert List of meta keys to prefix. |
| @@ -452,8 +446,18 @@ | ||
| 452 | 446 | ) |
| 453 | 447 | ); |
| 454 | 448 | } |
| 455 | 449 | } |
| 450 | + } | |
| 451 | + | |
| 452 | + /** | |
| 453 | + * Update the browser cache htaccess config due to updated rules. | |
| 454 | + */ | |
| 455 | + private static function update_470_update_browser_cache_htaccess_config() { | |
| 456 | + if (self::is_new_install()) return; | |
| 457 | + if (!WP_Optimize()->get_options()->get_option('enable_browser_cache')) return; | |
| 458 | + | |
| 459 | + WP_Optimize()->get_browser_cache()->restore(); | |
| 456 | 460 | } |
| 457 | 461 | } |
| 458 | 462 | |
| 459 | 463 | endif; |