Skip to content

Commit

Permalink
Merge branch 'release/3.5.51'
Browse files Browse the repository at this point in the history
  • Loading branch information
andykillen committed Jan 15, 2025
2 parents 5644edb + 635e25a commit 00ba1a8
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 12 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ If you want to build a local production-ready version of the plugin you can run

## Changelog

#### 3.5.51
* Added purge all on Customizer Update and Theme change.
* Added error messaging for when the 'post_row_actions' actions array is invalid, and Servebolt Optmizer is unable to add purge actions to CRUD pages.
* Bugfix: Updated Servebolt PHP-SDK so that the error "PHP Deprecated: Creation of dynamic property" does not show for PHP8.2+

#### 3.5.50
* Bugfix: added extra error checking around WooCommerce product purge after customer reported errors were found.
* Confirmed WordPress 6.7.1 support
Expand Down
7 changes: 6 additions & 1 deletion Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://servebolt.com
Requires at least: 4.9.2
Tested up to: 6.7.1
Requires PHP: 7.4
Stable tag: 3.5.50
Stable tag: 3.5.51
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

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

== Changelog ==

= 3.5.51 =
* Added purge all on Customizer Update and Theme change.
* Added error messaging for when the 'post_row_actions' actions array is invalid, and Servebolt Optmizer is unable to add purge actions to CRUD pages.
* Bugfix: Updated Servebolt PHP-SDK so that the error "PHP Deprecated: Creation of dynamic property" does not show for PHP8.2+

= 3.5.50 =
* Bugfix: added extra error checking around WooCommerce product purge after customer reported errors were found.
* Confirmed WordPress 6.7.1 support
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"require": {
"php": "^7.3|^8.0",
"composer/installers": "^1.0",
"servebolt/sdk": "1.2.9"
"servebolt/sdk": "1.2.10"
},
"require-dev": {
"squizlabs/php_codesniffer": "*",
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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.50
Version: 3.5.51
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 @@ -123,10 +123,14 @@ public function addTermPurgeRowAction(array $actions, $term): array
*
* @param array $actions
* @param WP_Post $post
* @return array
* @return array|null
*/
public function addPostPurgeRowAction(array $actions, $post): array
public function addPostPurgeRowAction($actions, $post): array
{
if(!is_array($actions)) {
error_log('Purge action could not be added to post row actions. Actions array is not an array.');
return $actions;
}
if (
$this->cacheFeatureIsAvailable()
&& PurgeActions::canPurgePostCache($post->ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public function deregisterEvents(): void
remove_action('update_option_permalink_structure', [$this, 'purgeAllOnPermalinkUpdates'], 99, 6);
remove_action('woocommerce_product_set_stock', [$this, 'purgePostOnWooCommerceUpdate'], 99);
remove_action('woocommerce_update_product', [$this, 'purgePostOnWooCommerceUpdate'], 99);
remove_action('customize_save_after', [$this, 'purgeAllOnCustomizerSave'], 99);
remove_action('switch_theme', [$this, 'purgeAllOnThemeChange'], 99);
}

/**
Expand Down Expand Up @@ -102,6 +104,16 @@ public function registerEvents()
add_action('woocommerce_product_set_stock', [$this, 'purgePostOnWooCommerceUpdate'], 99);
add_action('woocommerce_update_product', [$this, 'purgePostOnWooCommerceUpdate'], 99);
}

// Purge all when Customizer settings are saved
if(apply_filters('sb_optimizer_automatic_purge_on_customizer_save', true)) {
add_action('customize_save_after', [$this, 'purgeAllOnCustomizerSave'], 99);
}

// Purge all on Theme change
if(apply_filters('sb_optimizer_automatic_purge_on_theme_change', true)) {
add_action('switch_theme', [$this, 'purgeAllOnThemeChange'], 99);
}
}

/**
Expand Down Expand Up @@ -131,6 +143,26 @@ function purgePostOnWooCommerceUpdate($product)
}
}

/**
* Purge all cache when Customizer settings are saved.
*
* @return void
*/
function purgeAllOnThemeChange()
{
WordPressCachePurge::purgeAll();
}

/**
* Purge all cache when Customizer settings are saved.
*
* @return void
*/
function purgeAllOnCustomizerSave()
{
WordPressCachePurge::purgeAll();
}

/**
* Purge all cache when permalinks are updated.
*
Expand Down

0 comments on commit 00ba1a8

Please sign in to comment.