replaced wp-cron adding/removing method, 1.2 beta2
This commit is contained in:
parent
0997e19245
commit
5b5bf7fbdc
1 changed files with 23 additions and 5 deletions
|
@ -185,10 +185,9 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
|
||||||
/* add filter for catching canonical redirects */
|
/* add filter for catching canonical redirects */
|
||||||
add_filter('redirect_canonical', 'wp_ffpc_redirect_callback', 10, 2);
|
add_filter('redirect_canonical', 'wp_ffpc_redirect_callback', 10, 2);
|
||||||
|
|
||||||
if ( !wp_next_scheduled( self::precache_id ) && $this->options['precache_schedule'] != 'null' && $this->scheduled === false ) {
|
/* clean up schedule if needed */
|
||||||
$this->scheduled = wp_schedule_event( time(), $this->options['precache_schedule'] , self::precache_id );
|
if ( !isset( $this->options['precache_schedule'] ) || $this->options['precache_schedule'] == 'null' ) {
|
||||||
}
|
$this->log ( 'CRON clearing event' );
|
||||||
else {
|
|
||||||
wp_clear_scheduled_hook ( self::precache_id );
|
wp_clear_scheduled_hook ( self::precache_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -750,6 +749,19 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
|
||||||
*/
|
*/
|
||||||
public function plugin_hook_options_save( $activating ) {
|
public function plugin_hook_options_save( $activating ) {
|
||||||
|
|
||||||
|
/* schedule cron if posted */
|
||||||
|
$schedule = wp_get_schedule( self::precache_id );
|
||||||
|
if ( $this->options['precache_schedule'] != 'null' ) {
|
||||||
|
/* clear all other schedules before adding a new in order to replace */
|
||||||
|
wp_clear_scheduled_hook ( self::precache_id );
|
||||||
|
$this->log ( __( 'Scheduling WP-CRON event', $this->plugin_constant ) );
|
||||||
|
$this->scheduled = wp_schedule_event( time(), $this->options['precache_schedule'] , self::precache_id );
|
||||||
|
}
|
||||||
|
elseif ( ( !isset($this->options['precache_schedule']) || $this->options['precache_schedule'] == 'null' ) && !empty( $schedule ) ) {
|
||||||
|
$this->log ( __('Clearing WP-CRON clearing event ' , $this->plugin_constant ) );
|
||||||
|
wp_clear_scheduled_hook ( self::precache_id );
|
||||||
|
}
|
||||||
|
|
||||||
/* flush the cache when news options are saved, not needed on activation */
|
/* flush the cache when news options are saved, not needed on activation */
|
||||||
if ( !$activating )
|
if ( !$activating )
|
||||||
$this->backend->clear();
|
$this->backend->clear();
|
||||||
|
@ -1109,6 +1121,12 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$baseurl = get_blog_option ( $site, 'siteurl' );
|
||||||
|
|
||||||
|
if ( !strstr( $permalink, $baseurl ) ) {
|
||||||
|
$permalink = $baseurl . $permalink;
|
||||||
|
}
|
||||||
|
|
||||||
/* collect permalinks */
|
/* collect permalinks */
|
||||||
$links[ $permalink ] = true;
|
$links[ $permalink ] = true;
|
||||||
|
|
||||||
|
@ -1171,4 +1189,4 @@ if ( ! class_exists( 'WP_FFPC' ) ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue