Add ability to update incorrect starttime.
parent
1e98ecb595
commit
967fe14b22
scripts
|
@ -509,10 +509,10 @@ MAIN: while( $loop ) {
|
|||
# Foreach database monitor and it's list of events.
|
||||
while ( my ( $db_monitor, $db_events ) = each(%$db_monitors) ) {
|
||||
Debug("Checking db events for monitor $db_monitor");
|
||||
if ( ! $db_events ) {
|
||||
Debug("Skipping db events for $db_monitor because there are none");
|
||||
next;
|
||||
}
|
||||
if ( ! $db_events ) {
|
||||
Debug("Skipping db events for $db_monitor because there are none");
|
||||
next;
|
||||
}
|
||||
|
||||
# If we found the monitor in the file system
|
||||
my $fs_events = $fs_monitors->{$db_monitor};
|
||||
|
@ -565,7 +565,9 @@ MAIN: while( $loop ) {
|
|||
Debug("Found fs event for $db_event, $age at " . $$fs_events{$db_event}->Path());
|
||||
my $Event = new ZoneMinder::Event( $db_event );
|
||||
if ( ! $Event->check_for_in_filesystem() ) {
|
||||
Warning("Not found at " . $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());
|
||||
if ( $$fs_events{$db_event}->Scheme() ne $Event->Scheme() ) {
|
||||
Info("Updating scheme on event $$Event{Id} from $$Event{Scheme} to $$fs_events{$db_event}{Scheme}");
|
||||
$Event->Scheme($$fs_events{$db_event}->Scheme());
|
||||
|
@ -574,6 +576,15 @@ MAIN: while( $loop ) {
|
|||
Info("Updating storage area on event $$Event{Id} from $$Event{StorageId} to $$fs_events{$db_event}{StorageId}");
|
||||
$Event->StorageId($$fs_events{$db_event}->StorageId());
|
||||
}
|
||||
if ( $$fs_events{$db_event}->StartTime() ne $Event->StartTime() ) {
|
||||
if ( $$Event{Scheme} eq 'Deep' ) {
|
||||
Info("Updating StartTime on event $$Event{Id} from $$Event{StartTime} to $$fs_events{$db_event}{StartTime}");
|
||||
$Event->StartTime($$fs_events{$db_event}->StartTime());
|
||||
} else {
|
||||
}
|
||||
$Event->save();
|
||||
}
|
||||
|
||||
$Event->save();
|
||||
}
|
||||
} # end if ! in fs_events
|
||||
|
@ -962,7 +973,7 @@ sub delete_empty_directories {
|
|||
return;
|
||||
}
|
||||
my @contents = map { ( $_ eq '.' or $_ eq '..' ) ? () : $_ } readdir( $DIR );
|
||||
Debug("delete_empty_directories $_[0] has " . @contents .' entries:' . ( @contents <= 2 ? join(',',@contents) : '' ));
|
||||
#Debug("delete_empty_directories $_[0] has " . @contents .' entries:' . ( @contents <= 2 ? join(',',@contents) : '' ));
|
||||
my @dirs = map { -d $_[0].'/'.$_ ? $_ : () } @contents;
|
||||
if ( @dirs ) {
|
||||
Debug("Have " . @dirs . " dirs");
|
||||
|
|
Loading…
Reference in New Issue