示例#1
0
 function index_action($id = '')
 {
     @(include PLUS_PATH . 'cron.cache.php');
     if (is_array($cron) && !empty($cron)) {
         foreach ($cron as $key => $value) {
             if ($id) {
                 if ($value['id'] == $id) {
                     $timestamp[$value['nexttime']] = $value;
                     $timestamp[$value['nexttime']]['cronkey'] = $key;
                 }
             } else {
                 if ($value['nexttime'] <= time()) {
                     $timestamp[$value['nexttime']] = $value;
                     $timestamp[$value['nexttime']]['cronkey'] = $key;
                 }
             }
         }
         if ($timestamp) {
             krsort($timestamp);
             $croncache = current($timestamp);
             ignore_user_abort();
             set_time_limit(600);
             if (file_exists(LIB_PATH . 'cron/' . $croncache['dir'])) {
                 include LIB_PATH . 'cron/' . $croncache['dir'];
                 if ($croncache['dir'] == "notice.php") {
                     $notice = new notice($this->obj);
                     $notice->index();
                 }
             }
             $nexttime = $this->nextexe($croncache);
             $this->obj->DB_update_all("cron", "`nowtime`='" . time() . "',`nexttime`='" . strtotime($nexttime) . "'", "`id`='" . $value['id'] . "'");
             $cron[$croncache['cronkey']]['nexttime'] = strtotime($nexttime);
             $data['cron'] = ArrayToString($cron);
             made_web_array(PLUS_PATH . 'cron.cache.php', $data);
         }
     }
 }
示例#2
0
 public function desc_cache($dir)
 {
     $DescClassList = $this->obj->DB_select_all('desc_class', '1 order by sort asc');
     $DescList = $this->obj->DB_select_all('description', '1 AND `is_nav`=1 order by sort asc', '`id`,`nid`,`name`,`url`,`title`,`is_type`');
     foreach ($DescList as $k => $v) {
         foreach ($DescClassList as $k => $val) {
             if ($v['nid'] == $val['id']) {
                 $DescList[$k]['classname'] = $val['name'];
             }
         }
     }
     $data['desc_class'] = ArrayToString($DescClassList, true, true);
     $data['desc_list'] = ArrayToString($DescList, true, true);
     return made_web_array($this->cachedir . $dir, $data);
 }
示例#3
0
 public function cache($filename, $data)
 {
     $data_new['data'] = ArrayToString($data, true);
     $this->obj->DB_update_all("outside", "`lasttime`='" . mktime() . "'", "id='" . $filename . "'");
     return made_web_array($this->cachedir . $filename . ".php", $data_new);
 }