Skip to content

Instantly share code, notes, and snippets.

@mustafauysal
Last active May 23, 2023 14:39
Show Gist options
  • Save mustafauysal/c81e0141bd03120b71b37dfca40651b1 to your computer and use it in GitHub Desktop.
Save mustafauysal/c81e0141bd03120b71b37dfca40651b1 to your computer and use it in GitHub Desktop.

Revisions

  1. mustafauysal revised this gist May 23, 2023. 1 changed file with 6 additions and 3 deletions.
    9 changes: 6 additions & 3 deletions phast-purge-with-powered-cache.php
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,10 @@
    <?php

    add_action( 'powered_cache_flushed', 'flush_phast_cache' );
    add_action( 'powered_cache_purge_all_cache', 'flush_phast_cache' );
    add_action( 'powered_cache_clean_site_cache_dir', 'flush_phast_cache' );
    add_action( 'plugins_loaded', function () {
    add_action( 'powered_cache_flushed', 'flush_phast_cache' );
    add_action( 'powered_cache_purge_all_cache', 'flush_phast_cache' );
    add_action( 'powered_cache_clean_site_cache_dir', 'flush_phast_cache' );
    } );

    function flush_phast_cache() {
    $cache_dir = WP_CONTENT_DIR . '/cache/';
    @@ -12,3 +14,4 @@ function flush_phast_cache() {
    @unlink( $file );
    }
    }

  2. mustafauysal created this gist May 22, 2023.
    14 changes: 14 additions & 0 deletions phast-purge-with-powered-cache.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <?php

    add_action( 'powered_cache_flushed', 'flush_phast_cache' );
    add_action( 'powered_cache_purge_all_cache', 'flush_phast_cache' );
    add_action( 'powered_cache_clean_site_cache_dir', 'flush_phast_cache' );

    function flush_phast_cache() {
    $cache_dir = WP_CONTENT_DIR . '/cache/';

    $db_files = glob( $cache_dir . 'phast.*/*sqlite3*' );
    foreach ( $db_files as $file ) {
    @unlink( $file );
    }
    }