Add code to see if a db event is stored at the wrong storage area

This commit is contained in:
Isaac Connor 2018-11-23 10:10:50 -05:00
parent d8d9544497
commit 73d27f5095
1 changed files with 13 additions and 0 deletions

View File

@ -531,6 +531,19 @@ MAIN: while( $loop ) {
next;
}
Debug("Event $db_event is not in fs. Should have been at ".$Event->Path());
# Check for existence in other Storage Areas
foreach my $Storage ( ZoneMinder::Storage->find( ( $$Event{StorageId} ? ( 'Id !='=>$$Event{StorageId} ) : () ) ) ) {
my $path = $Storage->Path().'/'.$Event->RelativePath();
if ( -e $path ) {
Info("Event $$Event{Id} found at $path instead of $$Event{Path}");
if ( confirm() ) {
$Event->save({StorageId=>$$Storage{Id}});
last;
}
} else {
Debug("$$Event{Id} Not found at $path");
}
}
if ( $Event->Archived() ) {
Warning("Event $$Event{Id} is Archived. Taking no further action on it.");
next;