if ( $this->get_cache_lifespan() && ! wp_next_scheduled( static::EVENT_NAME ) ) {
$interval = $this->get_interval();
wp_schedule_event( time() + $interval, 'rocket_expired_cache_cron_interval', static::EVENT_NAME );
}
}
/**
* Gets the interval when the scheduled clean cache purge needs to run.
* If Minutes option is selected, then the interval will be set to minutes.
* If Hours / Days options are selected, then it will be set to 1 hour.
*
* @since 3.4.3
* @access private
* @author Soponar Cristina
*
* @return int $interval Interval time in seconds.
*/
private function get_interval() {
$unit = $this->options->get( 'purge_cron_unit' );
$lifespan = $this->options->get( 'purge_cron_interval', 10 );
$interval = HOUR_IN_SECONDS;
if ( ! $unit || ! defined( $unit ) ) {
$unit = 'HOUR_IN_SECONDS';
}
if ( 'MINUTE_IN_SECONDS' === $unit ) {
$interval = $lifespan * MINUTE_IN_SECONDS;
}
return $interval;
}
/**
* Unschedule the event.
*
* @since 3.4
* @access public
* @author Grégory Viguier
*/
public function unschedule_event() {
wp_clear_scheduled_hook( static::EVENT_NAME );
}
/**
* Perform the event action.
*
* @since 3.4
* @access public
* @author Grégory Viguier
*/
public function purge_expired_files() {
$this->purge->purge_expired_files( $this->get_cache_lifespan() );
}
/**
* Get the cache lifespan in seconds.
* If no value is filled in the settings, return 0. It means the purge is disabled.
* If the value from the settings is filled but invalid, fallback to the initial value (10 hours).
*
* @since 3.4
* @access public
* @author Grégory Viguier
*
* @return int The cache lifespan in seconds.
*/
public function get_cache_lifespan() {
$lifespan = $this->options->get( 'purge_cron_interval' );
if ( ! $lifespan ) {
return 0;
}
$unit = $this->options->get( 'purge_cron_unit' );
if ( $lifespan < 0 || ! $unit || ! defined( $unit ) ) {
return 10 * HOUR_IN_SECONDS;
}
return $lifespan * constant( $unit );
}
}
Fatal error: Uncaught Error: Call to a member function withArgument() on null in /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/ServiceProvider/class-common-subscribers.php:64
Stack trace:
#0 /home/payon/public_html/wp-content/plugins/wp-rocket/vendor/league/container/src/ServiceProvider/ServiceProviderAggregate.php(84): WP_Rocket\ServiceProvider\Common_Subscribers->register()
#1 /home/payon/public_html/wp-content/plugins/wp-rocket/vendor/league/container/src/Container.php(88): League\Container\ServiceProvider\ServiceProviderAggregate->register('cdn_subscriber')
#2 /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/class-plugin.php(186): League\Container\Container->get('cdn_subscriber')
#3 /home/payon/public_html/wp-content/plugins/wp-rocket/inc/main.php(40): WP_Rocket\Plugin->load()
#4 /home/payon/public_html/wp-includes/class-wp-hook.php(308): rocket_init('')
#5 /home/payon/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array)
#6 /home/payon/public_html/wp-in in /home/payon/public_html/wp-content/plugins/wp-rocket/inc/classes/ServiceProvider/class-common-subscribers.php on line 64