mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-05-24 00:24:07 +03:00
Allow viewing of past logs.
Add a command-line PHP script for rotation in cron.
This commit is contained in:
parent
56c1789b30
commit
f081d96b0c
4 changed files with 88 additions and 9 deletions
|
@ -308,6 +308,27 @@ function rotatelogs() {
|
|||
|
||||
}
|
||||
|
||||
function listrotatedlogs() {
|
||||
global $logging, $logsdirectory;
|
||||
if ($logging !== TRUE)
|
||||
return FALSE;
|
||||
|
||||
$list = scandir($logsdirectory,SCANDIR_SORT_DESCENDING);
|
||||
|
||||
if($list === FALSE) {
|
||||
writelog("Logs directory cannot read.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$list=array_filter($list,
|
||||
function ($val) {
|
||||
return(preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{6}\.json/',$val) == 1);
|
||||
}
|
||||
);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
function writelog($line) {
|
||||
global $logging;
|
||||
if ($logging !== TRUE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue