Do no commit on error as it releases locks. Add better storage loading error handling
This commit is contained in:
parent
a258567c16
commit
522f8dd5ba
|
@ -358,25 +358,27 @@ sub checkFilter {
|
|||
}
|
||||
} # end if AutoDelete
|
||||
|
||||
if ( $filter->{AutoMove} ) {
|
||||
my $NewStorage = new ZoneMinder::Storage($filter->{AutoMoveTo});
|
||||
Info("Moving event $Event->{Id} to datastore $filter->{AutoMoveTo}");
|
||||
$_ = $Event->MoveTo($NewStorage);
|
||||
Error($_) if $_;
|
||||
if ($filter->{AutoMove}) {
|
||||
my $NewStorage = ZoneMinder::Storage->find_one(Id=>$filter->{AutoMoveTo});
|
||||
if ($NewStorage) {
|
||||
Info("Moving event $Event->{Id} to datastore $filter->{AutoMoveTo}");
|
||||
$_ = $Event->MoveTo($NewStorage);
|
||||
Error($_) if $_;
|
||||
} else {
|
||||
Error("No storage area found for move to operation. AutoMoveTo was $$filter{AutoMoveTo}");
|
||||
}
|
||||
}
|
||||
if ( $filter->{AutoCopy} ) {
|
||||
if ($filter->{AutoCopy}) {
|
||||
# Copy To is different from MoveTo in that it JUST copies the files
|
||||
# So we still need to update the Event object with the new SecondaryStorageId
|
||||
my $NewStorage = ZoneMinder::Storage->find_one(Id=>$filter->{AutoCopyTo});
|
||||
if ( $NewStorage ) {
|
||||
Info("Copying event $Event->{Id} to datastore $filter->{AutoCopyTo}");
|
||||
$_ = $Event->CopyTo($NewStorage);
|
||||
if ( $_ ) {
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
if ($_) {
|
||||
Error($_);
|
||||
} else {
|
||||
$Event->save({SecondaryStorageId=>$$NewStorage{Id}});
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
}
|
||||
} else {
|
||||
Error("No storage area found for copy to operation. AutoCopyTo was $$filter{AutoCopyTo}");
|
||||
|
|
Loading…
Reference in New Issue