From 4651e5b003e9ca1ead0120b9a46ff53ecb91569f Mon Sep 17 00:00:00 2001 From: Janne Aalto Date: Thu, 27 Jun 2019 11:27:37 +0300 Subject: [PATCH] remove switch to main blog on multisite --- .../wp-amazon-c3-cloudfront-clear-cache.php | 22 ------------------- readme.txt | 0 2 files changed, 22 deletions(-) delete mode 100644 readme.txt diff --git a/classes/wp-amazon-c3-cloudfront-clear-cache.php b/classes/wp-amazon-c3-cloudfront-clear-cache.php index a0e3597..1f32807 100644 --- a/classes/wp-amazon-c3-cloudfront-clear-cache.php +++ b/classes/wp-amazon-c3-cloudfront-clear-cache.php @@ -528,16 +528,11 @@ public function flush_all( $lang = null ) { */ public function schedule_single_event( $hook = 'c3cf_cron_invalidation', $args = [] ) { - // Always schedule events on primary blog - $this->switch_to_blog(); - if ( ! wp_next_scheduled( $hook ) ) { //wp-cron is run every 10 minutes with cron, so try to hit every one.. $timestamp = time(); wp_schedule_single_event( $timestamp, $hook, $args ); } - - $this->restore_current_blog(); } /** @@ -553,15 +548,10 @@ public function schedule_event( $interval = null, $hook = 'c3cf_cron_invalidatio $interval = $hook; } - // Always schedule events on primary blog - $this->switch_to_blog(); - if ( ! wp_next_scheduled( $hook ) ) { wp_schedule_event( time(), $interval, $hook, $args ); } - $this->restore_current_blog(); - } /** @@ -574,18 +564,6 @@ public function clear_scheduled_event( $hook = 'c3cf_cron_invalidation' ) { if ( $timestamp ) { wp_unschedule_event( $timestamp, $hook ); } - - if ( is_multisite() ) { - // Always clear schedule events on primary blog - $this->switch_to_blog(); - - $timestamp = wp_next_scheduled( $hook ); - if ( $timestamp ) { - wp_unschedule_event( $timestamp, $hook ); - } - - $this->restore_current_blog(); - } } /** diff --git a/readme.txt b/readme.txt deleted file mode 100644 index e69de29..0000000