当前位置: 首页>>代码示例>>PHP>>正文


PHP BackWPup_Job::clean_temp_folder方法代码示例

本文整理汇总了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));
             }
         }
     }
 }
开发者ID:congtrieu112,项目名称:anime,代码行数:58,代码来源:class-cron.php


注:本文中的BackWPup_Job::clean_temp_folder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。