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
4 changes: 4 additions & 0 deletions inc/CLI_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class CLI_Command extends WP_CLI_Command {
* Success: The OPcache was successfully cleared!
*/
public function clear() {
wp_set_current_user( 0 );

$response = wp_remote_post(
add_query_arg( [
'opcache_action' => 'clear-opcache',
Expand Down Expand Up @@ -67,6 +69,8 @@ public function clear() {
* Success: The OPcache was successfully invalidated for foo/bar.php.
*/
public function invalidate( array $args, array $assoc_args ) {
wp_set_current_user( 0 );

$script = $args['0'];
$response = wp_remote_post(
add_query_arg( [
Expand Down
2 changes: 1 addition & 1 deletion wp-cli-clear-opcache.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WP-CLI Clear OPcache
* Plugin URI: https://github.com/wearerequired/wp-cli-clear-opcache
* Description: Use WP-CLI to clear the OPcache for a site via HTTP.
* Version: 1.0.1
* Version: 1.0.2
* Author: required
* Author URI: https://required.com
* License: GPL v2.0+
Expand Down