2020-05-16 15:18:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
class Log extends Template
|
|
|
|
{
|
|
|
|
//TODO: to server manager
|
|
|
|
function getSystemMemInfo()
|
|
|
|
{
|
|
|
|
$data = explode("\n", file_get_contents("/proc/meminfo"));
|
|
|
|
$meminfo = array();
|
|
|
|
foreach ($data as $line) {
|
|
|
|
$data = explode(":", $line);
|
|
|
|
if (count($data)!=2) continue;
|
|
|
|
$meminfo[$data[0]] = trim($data[1]);
|
|
|
|
}
|
|
|
|
return $meminfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
function __construct()
|
|
|
|
{
|
2020-07-20 17:15:23 +00:00
|
|
|
$userManager = new UserManager();
|
|
|
|
global $lang;
|
2020-05-16 15:18:27 +00:00
|
|
|
|
|
|
|
if (!$userManager->isLogin()){
|
|
|
|
header('Location: ' . BASEURL . 'login');
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = new Template('log');
|
|
|
|
$template->prepare('title', 'Log');
|
|
|
|
|
|
|
|
$result = array();
|
|
|
|
$cdir = scandir('../logs/');
|
|
|
|
foreach ($cdir as $key => $value)
|
|
|
|
{
|
|
|
|
if (!in_array($value,array(".","..", ".gitkeep")))
|
|
|
|
{
|
|
|
|
$result[$value] = $value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$template->prepare('baseDir', BASEDIR);
|
|
|
|
$template->prepare('debugMod', DEBUGMOD);
|
|
|
|
$template->prepare('logToLiveTime', LOGTIMOUT);
|
|
|
|
$template->prepare('title', 'Logy');
|
|
|
|
$template->prepare('logsFiles', $result);
|
|
|
|
$template->prepare('langMng', $langMng);
|
|
|
|
$template->prepare('CPU', sys_getloadavg()[0]);
|
|
|
|
$template->prepare('UPTIME', shell_exec('uptime -p'));
|
|
|
|
$template->prepare('ramFree', $this->getSystemMemInfo()["MemFree"]);
|
|
|
|
$template->prepare('ramTotal', $this->getSystemMemInfo()["MemTotal"]);
|
|
|
|
$template->prepare('diskTotal', disk_total_space("/"));
|
|
|
|
$template->prepare('serverTime', date('m. d. Y H:i:s - e'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$template->render();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|