Skip to content

Commit

Permalink
autoptimize and object cache pro flushes
Browse files Browse the repository at this point in the history
  • Loading branch information
lukanja committed Oct 8, 2024
1 parent 23cca52 commit 48df0bd
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions inc/admin/adminbar.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,27 @@ function air_helper_flush_all_caches() {
}

if ( is_plugin_active( 'autoptimize/autoptimize.php' ) ) {
if ( ! class_exists( 'autoptimizeCache' ) ) {
return;
}
$success = autoptimizeCache::clearall();
}

if ( is_plugin_active( 'object-cache-pro/object-cache-pro.php' ) ) {
// Check if Object Cache Pro class exists
if ( ! class_exists( 'RedisCachePro\Console\Commands' ) ) {
return;
}

function flushRedis( $arguments, $options ) {
$commands = new RedisCachePro\Console\Commands();
$commands->flush( $arguments, $options );
}

// Run the flush command
flushRedis( [], [] );
}

// Redirect back with parameters to show notice
wp_safe_redirect( add_query_arg( 'action', 'flush_all_caches', wp_get_referer() ) );
exit;
Expand Down

0 comments on commit 48df0bd

Please sign in to comment.