If failed to delete from Frames or Stats, return instead of deleting the event.

This commit is contained in:
Isaac Connor 2018-01-24 10:45:42 -05:00
parent a271f1776d
commit cf4ac74d02
1 changed files with 6 additions and 0 deletions

View File

@ -357,6 +357,9 @@ sub delete {
my $res = $sth->execute( $event->{Id} )
or Error( "Can't execute '$sql': ".$sth->errstr() );
$sth->finish();
if ( $ZoneMinder::Database::dbh->errstr() ) {
return;
}
$sql = 'DELETE FROM Stats WHERE EventId=?';
$sth = $ZoneMinder::Database::dbh->prepare_cached( $sql )
@ -364,6 +367,9 @@ sub delete {
$res = $sth->execute( $event->{Id} )
or Error( "Can't execute '$sql': ".$sth->errstr() );
$sth->finish();
if ( $ZoneMinder::Database::dbh->errstr() ) {
return;
}
$event->delete_files( );
} else {