mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +00:00
FileLog.pm: add archivesort attribute (Forum #67230)
git-svn-id: https://svn.fhem.de/fhem/trunk@13560 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
638ec2364a
commit
ee5f42e281
@ -45,6 +45,7 @@ FileLog_Initialize($)
|
||||
archiveCompress
|
||||
archivecmd
|
||||
archivedir
|
||||
archivesort
|
||||
createGluedFile:0,1
|
||||
disable:0,1
|
||||
disabledForIntervals
|
||||
@ -1257,6 +1258,7 @@ FileLog_regexpFn($$)
|
||||
|
||||
<a name="archivedir"></a>
|
||||
<a name="archivecmd"></a>
|
||||
<a name="archivesort"></a>
|
||||
<a name="nrarchive"></a>
|
||||
<li>archivecmd / archivedir / nrarchive<br>
|
||||
When a new FileLog file is opened, the FileLog archiver wil be called.
|
||||
@ -1265,6 +1267,9 @@ FileLog_regexpFn($$)
|
||||
section), and there is a new entry to be written into the file.
|
||||
<br>
|
||||
|
||||
archivesort may be the (default) alphanum or timestamp, and specifies
|
||||
how the last files are computed.<br>
|
||||
|
||||
If the attribute archivecmd is specified, then it will be started as a
|
||||
shell command (no enclosing " is needed), and each % in the command
|
||||
will be replaced with the name of the old logfile.<br>
|
||||
@ -1574,6 +1579,7 @@ FileLog_regexpFn($$)
|
||||
|
||||
<a name="archivedir"></a>
|
||||
<a name="archivecmd"></a>
|
||||
<a name="archivedir"></a>
|
||||
<a name="nrarchive"></a>
|
||||
<li>archivecmd / archivedir / nrarchive<br>
|
||||
Wenn eine neue FileLog-Datei geöffnet wird, wird der FileLog
|
||||
@ -1583,6 +1589,10 @@ FileLog_regexpFn($$)
|
||||
(define)</a> beschrieben werden) und gleichzeitig ein neuer Datensatz
|
||||
in diese Datei geschrieben werden muss. <br>
|
||||
|
||||
archivedir kann auf dem (voreingestellten) Wert alphanum oder timestamp
|
||||
gesetzt werden, und bestimmt die Methode für die
|
||||
Reihenfolgenberechnung der Dateien.<br>
|
||||
|
||||
Wenn das Attribut archivecmd benutzt wird, startet es als
|
||||
shell-Kommando ( eine Einbettung in " ist nicht notwendig), und jedes %
|
||||
in diesem Befehl wird durch den Namen des alten Logfiles ersetzt.<br>
|
||||
|
@ -270,6 +270,7 @@ my @globalAttrList = qw(
|
||||
apiversion
|
||||
archivecmd
|
||||
archivedir
|
||||
archivesort:timestamp,alphanum
|
||||
archiveCompress
|
||||
autoload_undefined_devices:1,0
|
||||
autosave:1,0
|
||||
@ -3453,8 +3454,9 @@ HandleArchiving($;$)
|
||||
my @t = localtime;
|
||||
$dir = ResolveDateWildcards($dir, @t);
|
||||
return if(!opendir(DH, $dir));
|
||||
my @files = sort { (stat("$dir/$a"))[9] cmp (stat("$dir/$b"))[9] } #66896
|
||||
grep {/^$file$/} readdir(DH);
|
||||
my @files = sort grep {/^$file$/} readdir(DH);
|
||||
@files = sort { (stat("$dir/$a"))[9] cmp (stat("$dir/$b"))[9] } @files
|
||||
if(AttrVal("global", "archivesort", "alphanum") eq "timestamp");
|
||||
closedir(DH);
|
||||
|
||||
my $max = int(@files)-$nra;
|
||||
|
Loading…
Reference in New Issue
Block a user