Don't run audit on default storage area. Add a test for an event having no endtime

pull/2077/head
Isaac Connor 2018-01-04 17:16:15 -05:00
parent 68166719ca
commit 224e261ade
1 changed files with 11 additions and 2 deletions

View File

@ -172,7 +172,6 @@ MAIN: while( $loop ) {
foreach my $Storage ( foreach my $Storage (
ZoneMinder::Storage->find( ($Config{ZM_SERVER_ID} ? ( ServerId => $Config{ZM_SERVER_ID} ) : () ) ), ZoneMinder::Storage->find( ($Config{ZM_SERVER_ID} ? ( ServerId => $Config{ZM_SERVER_ID} ) : () ) ),
new ZoneMinder::Storage(),
) { ) {
Debug('Checking events in ' . $Storage->Path() ); Debug('Checking events in ' . $Storage->Path() );
if ( ! chdir( $Storage->Path() ) ) { if ( ! chdir( $Storage->Path() ) ) {
@ -362,8 +361,18 @@ Debug("Event $db_event is not in fs.");
} }
next; next;
} }
if ( ! $Event->EndTime() ) {
Debug("Event $$Event{Id} has no end time. deleting it.");
if ( $age > $Config{ZM_AUDIT_MIN_AGE} ) {
if ( confirm() ) {
$Event->delete();
$cleaned = 1;
}
next;
}
}
if ( $Event->check_for_in_filesystem() ) { if ( $Event->check_for_in_filesystem() ) {
Debug('Database events apparently exists at ' . $Event->Path() ); Debug("Database event $$Event{Id} apparently exists at " . $Event->Path() );
} else { } else {
if ( $age > $Config{ZM_AUDIT_MIN_AGE} ) { if ( $age > $Config{ZM_AUDIT_MIN_AGE} ) {
aud_print( "Database event '$db_monitor/$db_event' does not exist at " . $Event->Path().' in filesystem' ); aud_print( "Database event '$db_monitor/$db_event' does not exist at " . $Event->Path().' in filesystem' );