Skip to content

Commit

Permalink
(v1.4.0) Purge on WP Core upgrade (fix #23)
Browse files Browse the repository at this point in the history
  • Loading branch information
lsthompson committed Feb 21, 2025
1 parent e280965 commit d8a8492
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 17 deletions.
8 changes: 3 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
# Changelog
All notable changes to TNC Toolbox for WordPress will be documented in this file.

## [1.4.0] - TBC 2025-##-##

### 🚀 Feature
- ??? (more cP API integrations?)
## [1.4.0] - 2025-02-21

### 💅 Polish
- Set max length of newly-relayed error (re: #22)
- Set max length of newly-relayed API error (re: #22)
- Auto-purge when WP Core is successfully upgraded (#23)

## [1.3.9] - 2024-12-31

Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

**WP.org:** https://wordpress.org/plugins/tnc-toolbox

- Allows you to purge the EA-NGINX User Cache from within WordPress
- Automatically purges the cache when a post or page is updated in WP
- Allows you to purge the EA-NGINX User Cache from within WP
- Automatically purges the cache when a post or page is updated
- Does the same when the WP Core has been successfully upgraded :)
- Allows you to disable or enable the NGINX User Cache from inside WP
- Only presents the options to enable/disable/configure for WP Admins
- For any action, redirects you back to the page you requested it from
Expand Down
2 changes: 2 additions & 0 deletions tnc-toolbox/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Newer history in readme.txt

= 1.3.5: December 10, 2023 =
* Config: No warning if empty (#13)
* ACL: On/Off/Config = Admins only (#14)
Expand Down
2 changes: 1 addition & 1 deletion tnc-toolbox/core/class-tnc-wp-toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,4 +143,4 @@ public function load_textdomain() {

}

endif; // End if class_exists check.
endif; // End if class_exists check.
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ public function output_text( $text = '' ){
* HELPER COMMENT END
*/

}
}
13 changes: 11 additions & 2 deletions tnc-toolbox/core/includes/classes/class-tnc-wp-toolbox-run.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,24 @@ function __construct(){
/////////////////////

private function add_hooks(){
// Make sure WP-Admin > Plugins contains hyperlinks
add_action( 'plugin_action_links_' . TNCWPTBOX_PLUGIN_BASE, array( $this, 'add_plugin_action_link' ), 20 );
// Register CSS so we get custom colours in top menu
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_custom_css' ) );
// Top-level menu item for WP-Admin area, register item
add_action( 'admin_bar_menu', array( $this, 'add_parent_menu_entry' ), 99 );
// Top-level child in menu, add cache purge (no ACL dep.)
add_action( 'admin_bar_menu', array( $this, 'add_cache_purge_button' ), 100 );
// Action for NGINX Cache Purge, register properly into WP
add_action( 'admin_post_nginx_cache_purge', array( $this, 'nginx_cache_purge' ) );
// Transient notice/error, register for both success & error
add_action( 'admin_notices', array( $this, 'tnc_wp_toolbox_cpanel_action_error_notice') );
add_action( 'admin_notices', array( $this, 'tnc_wp_toolbox_cpanel_action_success_notice') );
// Scheduled purging including post_updated event handled
add_action( 'tnc_scheduled_cache_purge', array( $this, 'nginx_cache_purge' ) );
add_action( 'post_updated', array( $this, 'purge_cache_on_update' ), 10, 3 );
add_action( 'post_updated', array( $this, 'purge_cache_on_update' ), 10, 3 );
// Purge the NGINX User Cache when WP Core is updated
add_action( '_core_updated_successfully', array( $this, 'nginx_cache_purge' ) );
}

// These are run from the parent class to ensure pluggable.php is ready
Expand Down Expand Up @@ -245,4 +254,4 @@ public function purge_cache_on_update( $post_id, $post_after, $post_before ) {
wp_schedule_single_event( time(), 'tnc_scheduled_cache_purge' );
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,4 @@ private function get_file_content($file_path) {
}
return '';
}
}
}
9 changes: 7 additions & 2 deletions tnc-toolbox/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ Tags: NGINX, Cache Purge, Web Performance, Automatic Purge, Freeware
Requires at least:
Tested up to: 6.7
Requires PHP:
Stable tag: 1.3.9
Stable tag: 1.4.0
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html

Adds functionality (cache purge, etc) to WP - designed for NGINX-powered Servers on cPanel+WHM. Made to help you fly online.
Adds functionality (cache purge, etc) to WP - designed for NGINX-powered Servers on cPanel+WHM. Made to help you fly online!


== Description ==
Expand All @@ -26,6 +26,7 @@ With a heavy focus on the Apache + NGINX as Reverse Caching Proxy web stack, the

- Allows you to enable, disable and purge the NGINX User Cache
- Purges the NGINX Cache magically on post/page publish/update!
- Also purges the Cache when the WP Core is successfully updated
- Lets you know if the plugin is activated but not yet configured
- Only allows Administrators to enable/disable caching; edit config

Expand Down Expand Up @@ -88,6 +89,10 @@ Please note there are pre-requisites to running the scripts, so understand & pre

== Changelog ==

= 1.4.0: Feb 21, 2025 =
* Truncate max-length of relayed API error to GUI (#22)
* Auto-purge when WP Core is successfully upgraded (#23)

= 1.3.9: Dec 31, 2024 =
* Pass-through error from cP API back to WP GUI (#22)
* Improve uncaught error wording, and clarify on user type
Expand Down
6 changes: 3 additions & 3 deletions tnc-toolbox/tnc-wp-toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
* @package TNCWPTBOX
* @author The Network Crew Pty Ltd (TNC)
* @license gplv3
* @version 1.3.9
* @version 1.4.0
*
* @wordpress-plugin
* Plugin Name: TNC Toolbox: Web Performance
* Plugin URI: https://merlot.digital
* Description: Adds functionality to WP - designed for NGINX-powered Servers on cPanel+WHM. Made to help you fly online!
* Version: 1.3.9
* Version: 1.4.0
* Author: The Network Crew Pty Ltd (TNC)
* Author URI: https://tnc.works
* Domain Path: /languages
Expand Down Expand Up @@ -46,7 +46,7 @@
define( 'TNCWPTBOX_NAME', 'TNC Toolbox' );

// Plugin version
define( 'TNCWPTBOX_VERSION', '1.3.9' );
define( 'TNCWPTBOX_VERSION', '1.4.0' );

// Plugin Root File
define( 'TNCWPTBOX_PLUGIN_FILE', __FILE__ );
Expand Down

0 comments on commit d8a8492

Please sign in to comment.