Plugin Directory

Changeset 2925848


Ignore:
Timestamp:
06/14/2023 11:26:57 AM (3 years ago)
Author:
leopardhost
Message:

v1.3.4: Fix regression with new auto-purge feature

Location:
tnc-toolbox
Files:
20 added
4 edited

Legend:

Unmodified
Added
Removed
  • tnc-toolbox/trunk/core/includes/classes/class-tnc-wp-toolbox-run.php

    r2925615 r2925848  
    8282        add_action( 'admin_notices', array( $this, 'tnc_wp_toolbox_nginx_action_error_notice') );
    8383        add_action( 'admin_notices', array( $this, 'tnc_wp_toolbox_nginx_action_success_notice') );
    84         add_action( 'save_post', array( $this, 'purge_cache_on_update' ), 10, 3 );
    85         add_action( 'post_updated', array( $this, 'purge_cache_on_update' ), 10, 3 );
    86    
     84        add_action( 'tnc_scheduled_cache_purge', array( $this, 'nginx_cache_purge' ) );
     85        add_action( 'post_updated', array( $this, 'purge_cache_on_update' ), 10, 3 );   
    8786    }
    8887
     
    149148        wp_enqueue_style( 'tnc_custom_css' );
    150149        $custom_css = "
    151             /* .nginx-cache-btn.nginx-cache-off a { background-color: #d63638 !important; }
     150            .nginx-cache-btn.nginx-cache-off a { background-color: #d63638 !important; }
    152151            .nginx-cache-btn.nginx-cache-purge a { background-color: #ff9500 !important; }
    153             .nginx-cache-btn.nginx-cache-on a { background-color: green !important; } */
     152            .nginx-cache-btn.nginx-cache-on a { background-color: green !important; }
    154153        ";
    155154        wp_add_inline_style( 'tnc_custom_css', $custom_css );
     
    289288     * @return void
    290289     */
    291     public function purge_cache_on_update( $post_id, $post, $update ){
     290    public function purge_cache_on_update( $post_id, $post_after, $post_before ) {
    292291        // Check if the post is published or updated
    293         if ( 'publish' === $post->post_status || $update ) {
    294             // Purge the cache
    295             $this->nginx_cache_purge();
     292        if ( 'publish' === $post_after->post_status || ( $post_before->post_status === 'publish' && $post_after->post_status !== 'trash' ) ) {
     293            // Schedule the cache purge to run after the current request
     294            wp_schedule_single_event( time(), 'tnc_scheduled_cache_purge' );
    296295        }
    297296    }
  • tnc-toolbox/trunk/core/includes/classes/class-tnc-wp-toolbox-settings.php

    r2925615 r2925848  
    190190        <div class="wrap">
    191191            <h1><?php echo esc_html( get_admin_page_title() ); ?></h1>
     192            <h4>To communicate with the cPanel API (UAPI), we need your API Token, Username & Server Hostname.</h4>
    192193            <form method="post">
    193194                <input type="hidden" name="action" value="tnc_toolbox_settings" />
  • tnc-toolbox/trunk/readme.txt

    r2925615 r2925848  
    88Tested up to: 6.2
    99Requires PHP:
    10 Stable tag: 1.3.3
     10Stable tag: 1.3.4
    1111License: GPLv2
    1212License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    6161== Changelog ==
    6262
    63 = 1.3.3: June 13, 2023 =
     63= 1.3.4: June 14, 2023 =
     64* Auto-purge: Fix GUI save issue
     65
     66= 1.3.3: June 14, 2023 =
    6467* Top bar links: Move into sub-menu
    6568
  • tnc-toolbox/trunk/tnc-wp-toolbox.php

    r2925615 r2925848  
    66 * @author        The Network Crew Pty Ltd
    77 * @license       gplv2
    8  * @version       1.3.3
     8 * @version       1.3.4
    99 *
    1010 * @wordpress-plugin
     
    1212 * Plugin URI:    https://leopard.host
    1313 * Description:   Adds functionality to WP that ties into your NGINX-powered Hosting on cPanel.
    14  * Version:       1.3.2
     14 * Version:       1.3.4
    1515 * Author:        The Network Crew Pty Ltd
    1616 * Author URI:    https://thenetworkcrew.com.au
     
    4747
    4848// Plugin version
    49 define( 'TNCWPTBOX_VERSION',        '1.3.3' );
     49define( 'TNCWPTBOX_VERSION',        '1.3.4' );
    5050
    5151// Plugin Root File
Note: See TracChangeset for help on using the changeset viewer.