本文整理汇总了PHP中BackWPup_Job::clean_temp_folder方法的典型用法代码示例。如果您正苦于以下问题:PHP BackWPup_Job::clean_temp_folder方法的具体用法?PHP BackWPup_Job::clean_temp_folder怎么用?PHP BackWPup_Job::clean_temp_folder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BackWPup_Job
的用法示例。
在下文中一共展示了BackWPup_Job::clean_temp_folder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_cleanup
/**
* Check Jobs worked and Cleanup logs and so on
*/
public static function check_cleanup()
{
$job_object = BackWPup_Job::get_working_data();
// check aborted jobs for longer than a tow hours, abort them courtly and send mail
if (is_object($job_object) && !empty($job_object->logfile)) {
$not_worked_time = microtime(TRUE) - $job_object->timestamp_last_update;
if ($not_worked_time > 3600) {
$job_object->log(E_USER_ERROR, __('Aborted, because no progress for one hour!', 'backwpup'), __FILE__, __LINE__);
$job_object->end();
}
}
//Compress not compressed logs
if (function_exists('gzopen') && get_site_option('backwpup_cfg_gzlogs') && !is_object($job_object)) {
//Compress old not compressed logs
if ($dir = opendir(get_site_option('backwpup_cfg_logfolder'))) {
$jobids = BackWPup_Option::get_job_ids();
while (FALSE !== ($file = readdir($dir))) {
if (is_writeable(get_site_option('backwpup_cfg_logfolder') . $file) && '.html' == substr($file, -5)) {
$compress = new BackWPup_Create_Archive(get_site_option('backwpup_cfg_logfolder') . $file . '.gz');
if ($compress->add_file(get_site_option('backwpup_cfg_logfolder') . $file)) {
unlink(get_site_option('backwpup_cfg_logfolder') . $file);
//change last logfile in jobs
foreach ($jobids as $jobid) {
$job_logfile = BackWPup_Option::get($jobid, 'logfile');
if (!empty($job_logfile) && $job_logfile == get_site_option('backwpup_cfg_logfolder') . $file) {
BackWPup_Option::update($jobid, 'logfile', get_site_option('backwpup_cfg_logfolder') . $file . '.gz');
}
}
}
unset($compress);
}
}
closedir($dir);
}
}
//Jobs cleanings
if (!is_object($job_object)) {
//remove restart cron
wp_clear_scheduled_hook('backwpup_cron', array('id' => 'restart'));
//temp cleanup
BackWPup_Job::clean_temp_folder();
}
//check scheduling jobs that not found will removed because there are single scheduled
$activejobs = BackWPup_Option::get_job_ids('activetype', 'wpcron');
if (!empty($activejobs)) {
foreach ($activejobs as $jobid) {
$cron_next = wp_next_scheduled('backwpup_cron', array('id' => $jobid));
if (!$cron_next || $cron_next < time()) {
wp_unschedule_event($cron_next, 'backwpup_cron', array('id' => $jobid));
$cron_next = BackWPup_Cron::cron_next(BackWPup_Option::get($jobid, 'cron'));
wp_schedule_single_event($cron_next, 'backwpup_cron', array('id' => $jobid));
}
}
}
}