Merge branch 'storageareas' of github.com:connortechnology/ZoneMinder into storageareas

This commit is contained in:
Isaac Connor 2019-05-08 06:06:28 -04:00
commit 4c8a29e8d3
4 changed files with 54 additions and 49 deletions

View File

@ -488,8 +488,8 @@ MAIN: while( $loop ) {
my $monitor_links;
foreach my $link ( glob('*') ) {
next if ( !-l $link );
next if ( -e $link );
next if !-l $link;
next if -e $link;
aud_print("Filesystem monitor link '$link' does not point to valid monitor directory");
if ( confirm() ) {
@ -498,11 +498,11 @@ MAIN: while( $loop ) {
executeShellCommand($command);
$cleaned = 1;
}
}
} # end foreach monitor link
} # end foreach Storage Area
if ( $cleaned ) {
Debug("Events were deleted, starting again.");
Debug('Events were deleted, starting again.');
redo MAIN;
}
@ -560,7 +560,7 @@ EVENT: while ( my ( $db_event, $age ) = each( %$db_events ) ) {
next;
}
if ( !$Event->StartTime() ) {
Info("Event $$Event{Id} has no start time.");
aud_print("Event $$Event{Id} has no start time.");
if ( confirm() ) {
$Event->delete();
$cleaned = 1;
@ -569,7 +569,7 @@ EVENT: while ( my ( $db_event, $age ) = each( %$db_events ) ) {
}
if ( ! $Event->EndTime() ) {
if ( $age > $Config{ZM_AUDIT_MIN_AGE} ) {
Info("Event $$Event{Id} has no end time and is $age seconds old. deleting it.");
aud_print("Event $$Event{Id} has no end time and is $age seconds old. Deleting it.");
if ( confirm() ) {
$Event->delete();
$cleaned = 1;
@ -587,14 +587,14 @@ EVENT: while ( my ( $db_event, $age ) = each( %$db_events ) ) {
$cleaned = 1;
}
} else {
aud_print( "Database event '".$Event->Path()." monitor:$db_monitor event:$db_event' does not exist in filesystem but too young to delete age: $age > MIN $Config{ZM_AUDIT_MIN_AGE}.\n" );
aud_print("Database event '".$Event->Path()." monitor:$db_monitor event:$db_event' does not exist in filesystem but too young to delete age: $age > MIN $Config{ZM_AUDIT_MIN_AGE}.");
}
} # end if exists in filesystem
} else {
Debug("Found fs event for id $db_event, $age seconds old at " . $$fs_events{$db_event}->Path());
my $Event = ZoneMinder::Event->find_one( Id=>$db_event );
if ( $Event and ! $Event->check_for_in_filesystem() ) {
Warning("Not found at " . $Event->Path() . ' was found at ' . $$fs_events{$db_event}->Path() );
Warning('Not found at ' . $Event->Path() . ' was found at ' . $$fs_events{$db_event}->Path());
Warning($Event->to_string());
Warning($$fs_events{$db_event}->to_string());
$$Event{Scheme} = '' if ! defined $$Event{Scheme};
@ -622,7 +622,7 @@ EVENT: while ( my ( $db_event, $age ) = each( %$db_events ) ) {
} # foreach db_event
} # end foreach db_monitor
if ( $cleaned ) {
Debug("Have done some cleaning, restarting.");
Debug('Have done some cleaning, restarting.');
redo MAIN;
}
@ -952,7 +952,7 @@ sub confirm {
}
$yesno = 1;
}
return( $yesno );
return $yesno;
}
sub deleteSwapImage {

View File

@ -1729,6 +1729,11 @@ bool Monitor::Analyse() {
);
closeEvent();
event = new Event(this, *timestamp, cause, noteSetMap);
shared_data->last_event = event->Id();
//set up video store data
snprintf(video_store_data->event_file, sizeof(video_store_data->event_file), "%s", event->getEventFile());
video_store_data->recording = event->StartTime();
}
} // end if event

View File

@ -96,7 +96,7 @@ class Storage {
$results = Storage::find($parameters, $options);
if ( count($results) > 1 ) {
Error("Storage Returned more than 1");
Error('Storage Returned more than 1');
return $results[0];
} else if ( count($results) ) {
return $results[0];
@ -239,5 +239,5 @@ class Storage {
}
return json_encode($json);
}
}
} // end class Storage
?>