Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions admin/class-fastcgi-purger.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,21 +162,31 @@ public function custom_purge_urls() {
}

/**
* Purge everything.
* Schedule Purge everything.
*/
public function purge_all() {
public function purge_all()
{

// Schedule the action if it's not already scheduled
// This to avoid overhead of buffering when there are too many directories
if (!wp_next_scheduled("nginx_helper_unlink_recursive")) {
wp_schedule_single_event(
time(),
"nginx_helper_unlink_recursive",
[RT_WP_NGINX_HELPER_CACHE_PATH, false]
);
}

$this->unlink_recursive( RT_WP_NGINX_HELPER_CACHE_PATH, false );
$this->log( '* * * * *' );
$this->log( '* Purged Everything!' );
$this->log( '* * * * *' );
$this->log('* * * * *');
$this->log('* Purged Everything has been scheduled');
$this->log('* * * * *');

/**
* Fire an action after the FastCGI cache has been purged.
*
* @since 2.1.0
*/
do_action( 'rt_nginx_helper_after_fastcgi_purge_all' );
do_action('rt_nginx_helper_after_fastcgi_purge_all');
}

/**
Expand Down
Loading