Skip to content

Commit

Permalink
remove switch to main blog on multisite
Browse files Browse the repository at this point in the history
  • Loading branch information
JanneAalto committed Jun 27, 2019
1 parent 8a00431 commit 4651e5b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions classes/wp-amazon-c3-cloudfront-clear-cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand All @@ -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();

}

/**
Expand All @@ -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();
}
}

/**
Expand Down
Empty file removed readme.txt
Empty file.

0 comments on commit 4651e5b

Please sign in to comment.