public function cron_status() { include ROOT_DIR . 'lib/class/cron.class.php'; $crond = new crond(); if ($this->settings['croncmd']) { $crond->setCronCmd($this->settings['croncmd']); } $cron_status = $crond->isRun(); $this->tpl->addVar('cron_status', $cron_status); $this->tpl->outTemplate('_cron_status', 'hg_set_dom_html,crontab_state'); }
/** * 获取系统运行状态信息 */ private function running_info() { include ROOT_DIR . 'lib/class/cron.class.php'; $crond = new crond(); if ($this->settings['croncmd']) { $crond->setCronCmd($this->settings['croncmd']); } $cron_status = $crond->isRun(); $sql = "SELECT a.host AS ahost,a.dir AS adir,mo.host,mo.dir,mo.file_name,mo.file_type,mo.mod_uniqueid FROM " . DB_PREFIX . "menu me \r\n\t\t\t\t\tLEFT JOIN " . DB_PREFIX . "modules mo ON me.module_id=mo.id \r\n\t\t\t\t\tLEFT JOIN " . DB_PREFIX . "applications a ON mo.application_id=a.id \r\n\t\t\t\tWHERE me.index=1 ORDER BY me.order_id asc, me.id ASC"; $q = $this->db->query($sql); $menu = array(); $curl = ''; while ($row = $this->db->fetch_array($q)) { $host = $row['host'] ? $row['host'] : $row['ahost']; $dir = $row['dir'] ? $row['dir'] : $row['adir']; if (!$host || !$dir) { continue; } $curl = new curl($host, $dir); $curl->setReturnFormat('json'); $curl->initPostData(); $curl->addRequestData('a', 'index'); $datas = $curl->request($row['file_name'] . $row['file_type']); $this->tpl->addVar('index_' . $row['mod_uniqueid'], $datas[0]); } $this->tpl->addVar('cron_status', $cron_status); }
public function show() { include ROOT_DIR . 'lib/class/cron.class.php'; $crond = new crond(); if ($this->settings['croncmd']) { $crond->setCronCmd($this->settings['croncmd']); } $cron_status = $crond->isRun(); $curl = new curl($this->settings['verify_custom_api']['host'], $this->settings['verify_custom_api']['dir']); $curl->setClient(CUSTOM_APPID, CUSTOM_APPKEY); $curl->setToken(''); $curl->setCurlTimeOut(5); $curl->setErrorReturn(''); $curl->mAutoInput = false; $curl->initPostData(); $postdata = array('a' => 'get_user_info'); foreach ($postdata as $k => $v) { $curl->addRequestData($k, $v); } $license = $curl->request('get_access_token.php'); if (!$license) { $this->ReportError('未获取到授权信息,请确认服务器网络正常或联系软件提供商'); } if ($license['ErrorCode'] == 'APP_AUTH_EXPIRED') { $this->ReportError('授权已到期,请联系软件提供商'); } $license = $license[0]; if ($license['appid']) { $license['expire'] = date('Y-m-d', $license['expire_time']); $license['leftday'] = intval(($license['expire_time'] - TIMENOW) / 86400); $this->tpl->addVar('license', $license); } $curl = new curl($this->settings['App_auth']['host'], $this->settings['App_auth']['dir']); $curl->setSubmitType('post'); $curl->setCurlTimeOut(5); $curl->setReturnFormat('json'); $ret = $curl->request('applications.php'); $instlled_apps = array(); $app_stats = array(); if (is_array($ret)) { foreach ($ret as $v) { $start_time = microtime(); $result = $this->check_status($v); $v['runtime'] = hg_page_debug($start_time); $v['inited'] = $result[1]['define']['INITED_APP']; $v['debuged'] = $result[1]['debuged']; $v['http_code'] = $result[0]['http_code']; $v['db'] = $result[1]['db']; $v['dbconnected'] = $result[1]['dbconnected']; $v['connect_time'] = $result[1]['connect_time']; $v['ip'] = gethostbyname($v['host']); $v['db']['ip'] = gethostbyname($v['db']['host']); $v['api_dir'] = $result[1]['api_dir']; $v['config_file_purview'] = $result[1]['config_file_purview']; $v['data_file_purview'] = $result[1]['data_file_purview']; $v['cache_file_purview'] = $result[1]['cache_file_purview']; $v['freespace'] = $result[1]['freespace']; if ($v['bundle'] == $_GET['b']) { print_r($v); exit; } $app_stats[$v['bundle']] = $v; } } if ($this->settings['App_livmedia']) { $curl = new curl($this->settings['App_livmedia']['host'], $this->settings['App_livmedia']['dir'] . 'admin/'); $curl->setErrorReturn(''); $curl->setCurlTimeOut(30); $curl->mAutoInput = false; $curl->initPostData(); $curl->addRequestData('a', 'stats'); $vod_status = $curl->request('vod.php'); $vod_status = $vod_status[0]; } $this->tpl->addVar('app_stats', $app_stats); $this->tpl->addVar('vod_status', $vod_status); $this->tpl->addVar('cron_status', $cron_status); $this->tpl->outTemplate('stats'); }