Changeset 3217776
- Timestamp:
- 01/06/2025 02:33:15 PM (14 months ago)
- Location:
- servebolt-optimizer
- Files:
-
- 12 edited
- 1 copied
-
tags/3.5.49 (copied) (copied from servebolt-optimizer/trunk)
-
tags/3.5.49/Readme.txt (modified) (1 diff)
-
tags/3.5.49/servebolt-optimizer.php (modified) (1 diff)
-
tags/3.5.49/src/Servebolt/Admin/ClearSiteDataHeader/ClearSiteDataHeader.php (modified) (1 diff)
-
tags/3.5.49/src/Servebolt/CachePurge/WpObjectCachePurgeActions/ContentChangeTrigger.php (modified) (4 diffs)
-
tags/3.5.49/src/Servebolt/FullPageCache/FullPageCacheHeaders.php (modified) (3 diffs)
-
tags/3.5.49/vendor/composer/installed.php (modified) (2 diffs)
-
trunk/Readme.txt (modified) (1 diff)
-
trunk/servebolt-optimizer.php (modified) (1 diff)
-
trunk/src/Servebolt/Admin/ClearSiteDataHeader/ClearSiteDataHeader.php (modified) (1 diff)
-
trunk/src/Servebolt/CachePurge/WpObjectCachePurgeActions/ContentChangeTrigger.php (modified) (4 diffs)
-
trunk/src/Servebolt/FullPageCache/FullPageCacheHeaders.php (modified) (3 diffs)
-
trunk/vendor/composer/installed.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
servebolt-optimizer/tags/3.5.49/Readme.txt
r3210419 r3217776 98 98 99 99 == Changelog == 100 101 = 3.5.49 = 102 * Added purge on WooCommerce stock change or product update, to cover purge events when save_post hook is not fired. 103 * Bugfix: Forcing max-age=0 on all posts that are status "Password Protected" to prevent ever being cached. 104 * Added extra image sizes to the SRCSET when using the image resizer to present clearer images on sites that do not have (m)any image sizes. 100 105 101 106 = 3.5.48 = -
servebolt-optimizer/tags/3.5.49/servebolt-optimizer.php
r3210419 r3217776 2 2 /* 3 3 Plugin Name: Servebolt Optimizer 4 Version: 3.5.4 84 Version: 3.5.49 5 5 Author: Servebolt 6 6 Author URI: https://servebolt.com -
servebolt-optimizer/tags/3.5.49/src/Servebolt/Admin/ClearSiteDataHeader/ClearSiteDataHeader.php
r2869325 r3217776 24 24 public function setHeader(): void 25 25 { 26 if (apply_filters('sb_optimizer_clear_site_data_header_active', true)) { 26 if (apply_filters('sb_optimizer_clear_site_data_header_active', true)) { 27 27 header('Clear-Site-Data: "cache", "storage"'); 28 28 } -
servebolt-optimizer/tags/3.5.49/src/Servebolt/CachePurge/WpObjectCachePurgeActions/ContentChangeTrigger.php
r3149848 r3217776 33 33 remove_action('set_object_terms', [$this, 'purgeCategoryTermsOnFirstSave'], 99, 6); 34 34 remove_action('update_option_permalink_structure', [$this, 'purgeAllOnPermalinkUpdates'], 99, 6); 35 remove_action('woocommerce_product_set_stock', [$this, 'purgePostOnWooCommerceUpdate'], 99); 36 remove_action('woocommerce_update_product', [$this, 'purgePostOnWooCommerceUpdate'], 99); 35 37 } 36 38 … … 96 98 } 97 99 98 } 99 100 // Purge post when comment is approved. 101 if (apply_filters('sb_optimizer_automatic_purge_on_woocommerce_update', true)) { 102 add_action('woocommerce_product_set_stock', [$this, 'purgePostOnWooCommerceUpdate'], 99); 103 add_action('woocommerce_update_product', [$this, 'purgePostOnWooCommerceUpdate'], 99); 104 } 105 } 106 107 /** 108 * Purge post on WooCommerce update. 109 * 110 * Covers both the stock update and the product update hooks. 111 * It uses the maybePurgePost method to check if the post is already 112 * scheduled for a purge or not. 113 * 114 * @param object $product 115 * 116 * @return void 117 */ 118 function purgePostOnWooCommerceUpdate($product) 119 { 120 if(method_exists($product, 'get_id')) return; 121 $this->maybePurgePost((int) $product->get_id()); 122 } 123 124 /** 125 * Purge all cache when permalinks are updated. 126 * 127 * @return void 128 */ 100 129 function purgeAllOnPermalinkUpdates() 101 130 { … … 126 155 if ( $taxonomy !== 'category' || (isset($terms[0]) && isset($old_tt_ids[0])) === false ) return; 127 156 // check if values match up, that we are only dealing with the default category in the correct way. 128 $default_category = get_option("default_category"); 157 $default_category = get_option("default_category"); 129 158 if( 130 159 (count($tt_ids) == 1 && $tt_ids[0] == $default_category) || … … 139 168 // don't do anything if its the default. It should never have to do this 140 169 // but just in case it does, better not to set an extra purge event. 141 if($term_id == $default_category) continue; 170 if($term_id == $default_category) continue; 142 171 $this->maybePurgeTerm((int) $term_id, $taxonomy); 143 172 } -
servebolt-optimizer/tags/3.5.49/src/Servebolt/FullPageCache/FullPageCacheHeaders.php
r3149848 r3217776 102 102 103 103 // Unauthenticated cache handling 104 if ($this->shouldSetCacheHeaders()) { 105 add_filter('posts_results', [$this, 'setHeaders']); 104 if ($this->shouldSetCacheHeaders()) { 105 add_filter('posts_results', [$this, 'setHeaders']); 106 106 add_filter('template_include', [$this, 'lastCall']); 107 107 add_filter('sb_optimizer_fullpage_cache_header_item', [$this, 'kill_cache_404'], 10); … … 180 180 // Only trigger this function once 181 181 remove_filter('posts_results', [$this, 'setHeaders']); 182 183 if ($this->isPasswordProtected()) { 184 $this->noCacheHeaders(); 185 if ($debug) { 186 $this->header('No-cache-trigger: 1'); 187 } 188 return $posts; 189 } 182 190 183 191 if ($this->isEcommerceNoCachePage()) { … … 271 279 272 280 /** 281 * Check if the current page is password protected. 282 * 283 * @return bool 284 */ 285 private function isPasswordProtected(): bool 286 { 287 global $wp_query; 288 if (!$wp_query->is_singular()) return false; 289 return apply_filters('sb_optimizer_fpc_password_protected_page', ( isset( $wp_query->post ) && ! empty( $wp_query->post->post_password ) ) ); 290 } 291 292 /** 273 293 * Check if we are in an Ecommerce-context and check if we should not cache. 274 294 * -
servebolt-optimizer/tags/3.5.49/vendor/composer/installed.php
r3210419 r3217776 2 2 'root' => array( 3 3 'name' => 'servebolt/servebolt-wp-optimize-plugin', 4 'pretty_version' => '3.5.4 8',5 'version' => '3.5.4 8.0',6 'reference' => 'a 72afbfd0be29c15d6c143faeab788efeb62ee8b',4 'pretty_version' => '3.5.49', 5 'version' => '3.5.49.0', 6 'reference' => 'a09a5f53539e4bacaabcc6d6ce5bfd7031f332e8', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 132 132 ), 133 133 'servebolt/servebolt-wp-optimize-plugin' => array( 134 'pretty_version' => '3.5.4 8',135 'version' => '3.5.4 8.0',136 'reference' => 'a 72afbfd0be29c15d6c143faeab788efeb62ee8b',134 'pretty_version' => '3.5.49', 135 'version' => '3.5.49.0', 136 'reference' => 'a09a5f53539e4bacaabcc6d6ce5bfd7031f332e8', 137 137 'type' => 'wordpress-plugin', 138 138 'install_path' => __DIR__ . '/../../', -
servebolt-optimizer/trunk/Readme.txt
r3210419 r3217776 98 98 99 99 == Changelog == 100 101 = 3.5.49 = 102 * Added purge on WooCommerce stock change or product update, to cover purge events when save_post hook is not fired. 103 * Bugfix: Forcing max-age=0 on all posts that are status "Password Protected" to prevent ever being cached. 104 * Added extra image sizes to the SRCSET when using the image resizer to present clearer images on sites that do not have (m)any image sizes. 100 105 101 106 = 3.5.48 = -
servebolt-optimizer/trunk/servebolt-optimizer.php
r3210419 r3217776 2 2 /* 3 3 Plugin Name: Servebolt Optimizer 4 Version: 3.5.4 84 Version: 3.5.49 5 5 Author: Servebolt 6 6 Author URI: https://servebolt.com -
servebolt-optimizer/trunk/src/Servebolt/Admin/ClearSiteDataHeader/ClearSiteDataHeader.php
r2869325 r3217776 24 24 public function setHeader(): void 25 25 { 26 if (apply_filters('sb_optimizer_clear_site_data_header_active', true)) { 26 if (apply_filters('sb_optimizer_clear_site_data_header_active', true)) { 27 27 header('Clear-Site-Data: "cache", "storage"'); 28 28 } -
servebolt-optimizer/trunk/src/Servebolt/CachePurge/WpObjectCachePurgeActions/ContentChangeTrigger.php
r3149848 r3217776 33 33 remove_action('set_object_terms', [$this, 'purgeCategoryTermsOnFirstSave'], 99, 6); 34 34 remove_action('update_option_permalink_structure', [$this, 'purgeAllOnPermalinkUpdates'], 99, 6); 35 remove_action('woocommerce_product_set_stock', [$this, 'purgePostOnWooCommerceUpdate'], 99); 36 remove_action('woocommerce_update_product', [$this, 'purgePostOnWooCommerceUpdate'], 99); 35 37 } 36 38 … … 96 98 } 97 99 98 } 99 100 // Purge post when comment is approved. 101 if (apply_filters('sb_optimizer_automatic_purge_on_woocommerce_update', true)) { 102 add_action('woocommerce_product_set_stock', [$this, 'purgePostOnWooCommerceUpdate'], 99); 103 add_action('woocommerce_update_product', [$this, 'purgePostOnWooCommerceUpdate'], 99); 104 } 105 } 106 107 /** 108 * Purge post on WooCommerce update. 109 * 110 * Covers both the stock update and the product update hooks. 111 * It uses the maybePurgePost method to check if the post is already 112 * scheduled for a purge or not. 113 * 114 * @param object $product 115 * 116 * @return void 117 */ 118 function purgePostOnWooCommerceUpdate($product) 119 { 120 if(method_exists($product, 'get_id')) return; 121 $this->maybePurgePost((int) $product->get_id()); 122 } 123 124 /** 125 * Purge all cache when permalinks are updated. 126 * 127 * @return void 128 */ 100 129 function purgeAllOnPermalinkUpdates() 101 130 { … … 126 155 if ( $taxonomy !== 'category' || (isset($terms[0]) && isset($old_tt_ids[0])) === false ) return; 127 156 // check if values match up, that we are only dealing with the default category in the correct way. 128 $default_category = get_option("default_category"); 157 $default_category = get_option("default_category"); 129 158 if( 130 159 (count($tt_ids) == 1 && $tt_ids[0] == $default_category) || … … 139 168 // don't do anything if its the default. It should never have to do this 140 169 // but just in case it does, better not to set an extra purge event. 141 if($term_id == $default_category) continue; 170 if($term_id == $default_category) continue; 142 171 $this->maybePurgeTerm((int) $term_id, $taxonomy); 143 172 } -
servebolt-optimizer/trunk/src/Servebolt/FullPageCache/FullPageCacheHeaders.php
r3149848 r3217776 102 102 103 103 // Unauthenticated cache handling 104 if ($this->shouldSetCacheHeaders()) { 105 add_filter('posts_results', [$this, 'setHeaders']); 104 if ($this->shouldSetCacheHeaders()) { 105 add_filter('posts_results', [$this, 'setHeaders']); 106 106 add_filter('template_include', [$this, 'lastCall']); 107 107 add_filter('sb_optimizer_fullpage_cache_header_item', [$this, 'kill_cache_404'], 10); … … 180 180 // Only trigger this function once 181 181 remove_filter('posts_results', [$this, 'setHeaders']); 182 183 if ($this->isPasswordProtected()) { 184 $this->noCacheHeaders(); 185 if ($debug) { 186 $this->header('No-cache-trigger: 1'); 187 } 188 return $posts; 189 } 182 190 183 191 if ($this->isEcommerceNoCachePage()) { … … 271 279 272 280 /** 281 * Check if the current page is password protected. 282 * 283 * @return bool 284 */ 285 private function isPasswordProtected(): bool 286 { 287 global $wp_query; 288 if (!$wp_query->is_singular()) return false; 289 return apply_filters('sb_optimizer_fpc_password_protected_page', ( isset( $wp_query->post ) && ! empty( $wp_query->post->post_password ) ) ); 290 } 291 292 /** 273 293 * Check if we are in an Ecommerce-context and check if we should not cache. 274 294 * -
servebolt-optimizer/trunk/vendor/composer/installed.php
r3210419 r3217776 2 2 'root' => array( 3 3 'name' => 'servebolt/servebolt-wp-optimize-plugin', 4 'pretty_version' => '3.5.4 8',5 'version' => '3.5.4 8.0',6 'reference' => 'a 72afbfd0be29c15d6c143faeab788efeb62ee8b',4 'pretty_version' => '3.5.49', 5 'version' => '3.5.49.0', 6 'reference' => 'a09a5f53539e4bacaabcc6d6ce5bfd7031f332e8', 7 7 'type' => 'wordpress-plugin', 8 8 'install_path' => __DIR__ . '/../../', … … 132 132 ), 133 133 'servebolt/servebolt-wp-optimize-plugin' => array( 134 'pretty_version' => '3.5.4 8',135 'version' => '3.5.4 8.0',136 'reference' => 'a 72afbfd0be29c15d6c143faeab788efeb62ee8b',134 'pretty_version' => '3.5.49', 135 'version' => '3.5.49.0', 136 'reference' => 'a09a5f53539e4bacaabcc6d6ce5bfd7031f332e8', 137 137 'type' => 'wordpress-plugin', 138 138 'install_path' => __DIR__ . '/../../',
Note: See TracChangeset
for help on using the changeset viewer.