Skip to content

Commit

Permalink
Refactor cron cleanup to improve DRYness
Browse files Browse the repository at this point in the history
  • Loading branch information
raamdev committed Dec 7, 2015
1 parent 68744f3 commit dbbb273
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/includes/closures/Plugin/CronUtils.php
Expand Up @@ -20,13 +20,12 @@
return $schedules;
};


/*
* Resets `crons_setup` and clears WP-Cron schedules.
*
* @since 15xxxx Fixing bug with Auto-Cache Engine cron disappearing in some scenarios
*
* @note This MUST happen upon uninstall and deactivation due to buggy WP_Cron behavior; see http://bit.ly/1lGdr78
* @note This MUST happen upon uninstall and deactivation due to buggy WP_Cron behavior. Events with a custom schedule will disappear when plugin is not active (see http://bit.ly/1lGdr78).
*/
$self->resetCronsSetup = function ( ) use ($self) {
if (is_multisite()) { // Main site CRON jobs.
Expand Down
4 changes: 2 additions & 2 deletions src/includes/closures/Plugin/InstallUtils.php
Expand Up @@ -69,7 +69,7 @@
$self->removeWpHtaccess();
$self->removeAdvancedCache();
$self->clearCache();
$self->resetCronsSetup(); // Events with a custom schedule will disappear (see http://bit.ly/1lGdr78); lets clean up to avoid any confusion.
$self->resetCronsSetup();
};

/*
Expand All @@ -93,7 +93,7 @@
$self->removeWpHtaccess();
$self->removeAdvancedCache();
$self->wipeCache();
$self->resetCronsSetup(); // Events with a custom schedule will disappear (see http://bit.ly/1lGdr78); lets clean up to avoid any confusion.
$self->resetCronsSetup();

if (!$self->options['uninstall_on_deletion']) {
return; // Nothing to do here.
Expand Down

0 comments on commit dbbb273

Please sign in to comment.