33 $msg->debug(
"log",
"list_logs_directory");
36 foreach (glob(
"${dir}/*log*") as $absfile) {
37 $c[] = array(
"name" => basename($absfile),
38 "creation_date" => date(
"F d Y H:i:s", filectime($absfile)),
39 "mtime" => filemtime($absfile),
40 "filesize" => filesize($absfile),
41 "downlink" => urlencode(basename($absfile)),
44 usort(
$c,
"m_log::compare_logtime");
53 return strcmp($a[
'name'], $b[
'name']);
61 return $b[
'mtime'] - $a[
'mtime'];
72 'link' =>
'logs_list.php',
84 $msg->debug(
"log",
"get_logs_directory_all");
86 foreach ($dirs as $dir =>
$val) {
95 $msg->debug(
"log",
"get_logs_directory");
97 if (defined(
'ALTERNC_LOGS_ARCHIVE')) {
98 $c = array(
"dir" => ALTERNC_LOGS_ARCHIVE .
"/" .
$cuid .
"-" .
$mem->user[
"login"]);
111 $msg->log(
"log",
"download_link");
112 header(
"Content-Disposition: attachment; filename=" . $file .
"");
113 header(
"Content-Type: application/force-download");
114 header(
"Content-Transfer-Encoding: binary");
116 $ff =
$f[
'dir'] .
"/" . basename($file);
124 function tail($file, $lines = 20) {
126 $msg->debug(
"log",
"tail");
127 $lines = intval($lines);
132 $ff =
$f[
'dir'] .
"/" . basename($file);
134 exec(
"tail -" . $lines .
" " . escapeshellarg($ff), $out);
135 return implode(
"\n", $out);
This class shows error or access logs of web server to the web panel.
hook_menu()
hook called by the menu class to add menu to the left panel
download_link($file)
download a log file
list_logs_directory_all($dirs)
list all log files in all log directories
list_logs_directory($dir)
List all logs files in a directory.
tail($file, $lines=20)
show the last lines of a file
compare_logname($a, $b)
Used by list_logs_directory to sort.
compare_logtime($a, $b)
Used by list_logs_directory to sort.