| Server IP : 146.59.209.152 / Your IP : 216.73.216.46 Web Server : Apache System : Linux webm005.cluster131.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue Sep 17 08:14:20 UTC 2024 x86_64 User : infrafs ( 43850) PHP Version : 8.2.29 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/infrafs/INFRABIKEDE/wp-content/plugins/sg-cachepress/core/Helper/ |
Upload File : |
<?php
namespace SiteGround_Optimizer\Helper;
use SiteGround_Optimizer\Helper\Helper;
/**
* Trait used for factory pattern in the plugin.
*/
trait Update_Queue_Trait {
/**
* Update the purge queue.
*
* @since 5.9.0
*
* @param string $urls The URLs to purge.
*/
public function update_queue( $urls ) {
// Get the current purge queue.
$queue = get_option( 'siteground_optimizer_smart_cache_purge_queue', array() );
// If there is already a data present on it, update the value.
$queue = array_unique( array_merge( $queue, $urls ) );
// Do not update the queue if a cronjob or ajax request is made.
if ( wp_doing_cron() || Helper::sg_doing_ajax() ) {
// Schedule a cron job that will delete all assets (minified js and css files) every 30 days.
if ( wp_next_scheduled( 'siteground_optimizer_purge_cron_cache' ) ) {
wp_clear_scheduled_hook( 'siteground_optimizer_purge_cron_cache' );
}
// Schedule a full cache purge cron.
wp_schedule_single_event( time() + 90, 'siteground_optimizer_purge_cron_cache' );
return;
}
update_option( 'siteground_optimizer_smart_cache_purge_queue', $queue );
}
}