gc_cache

gc_cache

Hook Type: action
See hook in action

See hook in core

Displaying hooks found in version: wp-super-cache.2.0.0

do_action('gc_cache') is found 7 times:

  • /wp-cache-phase2.php line 3268
    3264
    3265
    3266
    3267
    3268
    3269
    3270
    3271
    3272
    3273
    3274
    $dir = get_current_url_supercache_dir( $post_id );
    wp_cache_debug( "wp_cache_post_id_gc post_id: $post_id " . get_permalink( $post_id ) . " clearing cache in $dir.", 4 );
    if ( $all ) {
        prune_super_cache( $dir, true, true );
        do_action( 'gc_cache', 'prune', $permalink );
        @rmdir( $dir );
        $supercache_home = get_supercache_dir();
        wp_cache_debug( "wp_cache_post_id_gc clearing cache in {$supercache_home}page/." );
        prune_super_cache( $supercache_home . 'page/', true );
        do_action( 'gc_cache', 'prune', 'page/' );
    } else {
  • /wp-cache-phase2.php line 3273
    3269
    3270
    3271
    3272
    3273
    3274
    3275
    3276
    3277
    3278
    3279
        @rmdir( $dir );
        $supercache_home = get_supercache_dir();
        wp_cache_debug( "wp_cache_post_id_gc clearing cache in {$supercache_home}page/." );
        prune_super_cache( $supercache_home . 'page/', true );
        do_action( 'gc_cache', 'prune', 'page/' );
    } else {
        wp_cache_debug( "wp_cache_post_id_gc clearing cached index files in $dir.", 4 );
        prune_super_cache( $dir, true, true );
        do_action( 'gc_cache', 'prune', $permalink );
    }
    return true;
  • /wp-cache-phase2.php line 3277
    3273
    3274
    3275
    3276
    3277
    3278
    3279
    3280
    3281
    3282
    3283
            do_action( 'gc_cache', 'prune', 'page/' );
        } else {
            wp_cache_debug( "wp_cache_post_id_gc clearing cached index files in $dir.", 4 );
            prune_super_cache( $dir, true, true );
            do_action( 'gc_cache', 'prune', $permalink );
        }
        return true;
    }
     
    function wp_cache_post_change( $post_id ) {
        global $file_prefix, $cache_path, $blog_id, $super_cache_enabled, $blog_cache_dir, $wp_cache_refresh_single_only;
  • /wp-cache-phase2.php line 3352
    3348
    3349
    3350
    3351
    3352
    3353
    3354
    3355
    3356
    3357
    3358
    }
    if ( $all == true ) {
        wp_cache_debug( 'Post change: supercache enabled: deleting cache files in ' . $dir );
        wpsc_rebuild_files( $dir );
        do_action( 'gc_cache', 'prune', 'homepage' );
        if ( get_option( 'show_on_front' ) == 'page' ) {
            wp_cache_debug( 'Post change: deleting page_on_front and page_for_posts pages.', 4 );
            wp_cache_debug( 'Post change: page_on_front ' . get_option( 'page_on_front' ), 4 );
            /**
             * It's possible that page_for_posts is zero.
             * Quick fix to reduce issues in debugging.
  • /wp-cache-phase2.php line 3365
    3361
    3362
    3363
    3364
    3365
    3366
    3367
    3368
    3369
    3370
            if ( get_option( 'page_for_posts' ) ) {
                $permalink = trailingslashit( str_replace( get_option( 'home' ), '', get_permalink( get_option( 'page_for_posts' ) ) ) );
                wp_cache_debug( 'Post change: Deleting files in: ' . str_replace( '//', '/', $dir . $permalink ) );
                wpsc_rebuild_files( $dir . $permalink );
                do_action( 'gc_cache', 'prune', $permalink );
            }
        }
    } else {
        wp_cache_debug( 'wp_cache_post_change: not deleting all pages.', 4 );
    }
  • /wp-cache-phase2.php line 3401
    3397
    3398
    3399
    3400
    3401
    3402
    3403
    3404
    3405
    3406
    3407
            if ( false == $supercache_files_deleted && $super_cache_enabled == true ) {
                wp_cache_debug( "Post change: deleting supercache files for {$permalink}" );
                wpsc_rebuild_files( $dir . $permalink );
                $supercache_files_deleted = true;
                do_action( 'gc_cache', 'rebuild', $permalink );
            }
        }
    } elseif ( $meta['blog_id'] == $blog_id ) {
        wp_cache_debug( "Post change: deleting wp-cache files for {$meta[ 'uri' ]}: $file", 4 );
        @unlink( $blog_cache_dir . 'meta/' . $file );
        @unlink( $blog_cache_dir . $file );
  • /wp-cache-phase2.php line 3411
    3407
    3408
    3409
    3410
    3411
    3412
    3413
    3414
    3415
    3416
    3417
                    @unlink( $blog_cache_dir . $file );
                    if ( $super_cache_enabled == true ) {
                        wp_cache_debug( "Post change: deleting supercache files for {$meta[ 'uri' ]}" );
                        wpsc_rebuild_files( $dir . $meta['uri'] );
                        do_action( 'gc_cache', 'rebuild', trailingslashit( $meta['uri'] ) );
                    }
                }
            }
        }
    }
    closedir( $handle );

See this hook used in plugins: