<?php
/*
* Plugin-Name: Product Designer App
* Plugin-URI: https://productdesignerapp.com
* Author: productdesignerapp
* Cronjob
*/
if (!defined('ABSPATH'))
{
    exit;
}

/*
*	Cronjob remove trash data
*/
add_action('pdapp_cronjob_event', 'pdapp_cronjob_clean_datas');
if(!function_exists('pdapp_cronjob_clean_datas'))
{
	function pdapp_cronjob_clean_datas()
	{
		if(!function_exists('pdapp_clean_expired_token'))
		{
			return false;
		}

		/* Hourly cronjob */
		pdapp_clean_expired_token();

		/* Daily cronjob */
		$timeCheck = gmdate("Ymd");
		$oldCheck = pdapp_get_cache('cronjob', 'daily');
		if($oldCheck != $timeCheck)
		{
			pdapp_clean_upload();
			pdapp_set_cache('cronjob', 'daily', $timeCheck);
		}
	}
}
?>