Skip to content

Commit

Permalink
Merge branch 'release/3.5.50'
Browse files Browse the repository at this point in the history
Bugfix of fatal error when purging woocommerce product
  • Loading branch information
andykillen committed Jan 7, 2025
2 parents a09a5f5 + 86afa0b commit 5644edb
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ If you want to build a local production-ready version of the plugin you can run

## Changelog

#### 3.5.50
* Bugfix: added extra error checking around WooCommerce product purge after customer reported errors were found.
* Confirmed WordPress 6.7.1 support

#### 3.5.49
* Added purge on WooCommerce stock change or product update, to cover purge events when save_post hook is not fired.
* Forcing max-age=0 on all posts that are status "Password Protected" to prevent ever being cached.
Expand Down
9 changes: 6 additions & 3 deletions Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ Contributors: audunhus, erlendeide, servebolt, andrewkillen
Tags: performance, optimization, html cache, cloudflare , multisite
Donate link: https://servebolt.com
Requires at least: 4.9.2
Tested up to: 6.6.1
Tested up to: 6.7.1
Requires PHP: 7.4
Stable tag: 3.5.49
Stable tag: 3.5.50
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -98,10 +98,13 @@ If you're a Servebolt client, please reach out to our Support Team and we'll be

== Changelog ==

= 3.5.50 =
* Bugfix: added extra error checking around WooCommerce product purge after customer reported errors were found.
* Confirmed WordPress 6.7.1 support

= 3.5.49 =
* Added purge on WooCommerce stock change or product update, to cover purge events when save_post hook is not fired.
* Bugfix: Forcing max-age=0 on all posts that are status "Password Protected" to prevent ever being cached.
* 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.

= 3.5.48 =
* Bugfix: on Servebolt Linux 8/php 8.3+ the purge candidate urls were filtering too many out of being purgable.
Expand Down
2 changes: 1 addition & 1 deletion servebolt-optimizer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Servebolt Optimizer
Version: 3.5.49
Version: 3.5.50
Author: Servebolt
Author URI: https://servebolt.com
Description: A plugin that implements Servebolt Security & Performance best practises for WordPress.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,24 @@ public function registerEvents()
* It uses the maybePurgePost method to check if the post is already
* scheduled for a purge or not.
*
* @param object $product
* @param object|int $product
*
* @return void
*/
function purgePostOnWooCommerceUpdate($product)
{
if(method_exists($product, 'get_id')) return;
$this->maybePurgePost((int) $product->get_id());
try {
if(is_int($product)) {
$this->maybePurgePost((int) $product);
return;
}

if(!is_object($product)) return;
if(!method_exists($product, 'get_id')) return;
$this->maybePurgePost((int) $product->get_id());
} catch (\Exception $e) {
error_log('Error purging WooCommerce product cache on update: ' . $e->getMessage() );
}
}

/**
Expand Down

0 comments on commit 5644edb

Please sign in to comment.