Add more debugging

This commit is contained in:
Isaac Connor 2017-03-29 09:59:58 -04:00
parent a6261b5497
commit 8bb9ba7bea
3 changed files with 62 additions and 56 deletions

View File

@ -241,6 +241,7 @@ sub GenerateVideo {
sub delete {
my $event = $_[0];
Info( "Deleting event $event->{Id} from Monitor $event->{MonitorId} $event->{StartTime}\n" );
$ZoneMinder::Database::dbh->ping();
# Do it individually to avoid locking up the table for new events
my $sql = 'delete from Events where Id = ?';
my $sth = $ZoneMinder::Database::dbh->prepare_cached( $sql )
@ -331,12 +332,15 @@ sub delete_files {
sub Storage {
return new ZoneMinder::Storage( $_[0]{StorageId} );
}
sub check_for_in_filesystem {
my $path = $_[0]->Path();
if ( $path ) {
my @files = glob( $path . '/*' );
Debug("Checking for files for event $_[0]{Id} at $path using glob $path/* found " . scalar @files . " files");
return 1 if @files;
}
Debug("Checking for files for event $_[0]{Id} at $path using glob $path/* found no files");
return 0;
}

View File

@ -90,7 +90,6 @@ sub load {
Error( "Failure to load Object record for $$self{$primary_key}: Reason: " . $ZoneMinder::Database::dbh->errstr );
} else {
Debug("No Results Loading $type from $table WHERE $primary_key = $$self{$primary_key}");
} # end if
} # end if
} # end if

View File

@ -338,7 +338,10 @@ MAIN: while( $loop ) {
my $deleteStatsSth = $dbh->prepare_cached( $deleteStatsSql )
or Fatal( "Can't prepare '$deleteStatsSql': ".$dbh->errstr() );
# Foreach database monitor and it's list of events.
while ( my ( $db_monitor, $db_events ) = each(%$db_monitors) ) {
# If we found the monitor in the file system
if ( my $fs_events = $fs_monitors->{$db_monitor} ) {
next if ! $db_events;
@ -355,7 +358,7 @@ Debug("Event $db_event is not in fs.");
next;
}
if ( $Event->check_for_in_filesystem() ) {
Debug('Database events apparent exists at ' . $Event->Path() );
Debug('Database events apparently exists at ' . $Event->Path() );
} else {
if ( $age > $Config{ZM_AUDIT_MIN_AGE} ) {
aud_print( "Database event '$db_monitor/$db_event' does not exist at " . $Event->Path().' in filesystem' );