rough in Storage area support

This commit is contained in:
Isaac Connor 2015-12-22 11:50:29 -05:00
parent c9dc53b237
commit 06a5a6d879
1 changed files with 130 additions and 120 deletions

View File

@ -114,12 +114,15 @@ if ( ($report + $interactive + $continuous) > 1 )
my $dbh = zmDbConnect();
chdir( EVENT_PATH );
require ZoneMinder::Storage;
my $max_image_age = 6/24; # 6 hours
my $max_swap_age = 24/24; # 24 hours
my $image_path = IMAGE_PATH;
my $loop = 1;
my $cleaned = 0;
MAIN: while( $loop ) {
@ -176,6 +179,10 @@ MAIN: while( $loop ) {
}
my $fs_monitors;
foreach my $Storage ( new ZoneMinder::Storage(), ZoneMinder::Storage->find( ) ) {
chdir( $Storage->Path() );
foreach my $monitor ( glob("[0-9]*") )
{
Debug( "Found filesystem monitor '$monitor'" );
@ -221,7 +228,7 @@ MAIN: while( $loop ) {
}
}
}
chdir( EVENT_PATH );
chdir( $Storage->Path() );
}
}
else
@ -242,10 +249,10 @@ MAIN: while( $loop ) {
$fs_events->{$event} = (time() - ($^T - ((-M $event) * 24*60*60)));
}
}
chdir( EVENT_PATH );
}
chdir( $Storage->Path() );
} # if USE_DEEP_STORAGE
Debug( "Got ".int(keys(%$fs_events))." events\n" );
}
} # end foreach monitor
redo MAIN if ( $cleaned );
$cleaned = 0;
@ -262,7 +269,8 @@ MAIN: while( $loop ) {
aud_print( "Filesystem event '$fs_monitor/$fs_event' does not exist in database" );
if ( confirm() )
{
deleteEventFiles( $fs_event, $fs_monitor );
my $Event = new ZoneMinder::Event( $fs_event );
$Event->delete_files();
$cleaned = 1;
}
}
@ -296,6 +304,7 @@ MAIN: while( $loop ) {
$cleaned = 1;
}
}
} # end foreach Storage Area
redo MAIN if ( $cleaned );
$cleaned = 0;
@ -349,7 +358,8 @@ MAIN: while( $loop ) {
#$cleaned = 1;
#}
}
}
} # end foreach db monitors
redo MAIN if ( $cleaned );
# Remove orphaned events (with no monitor)
@ -553,7 +563,7 @@ MAIN: while( $loop ) {
;
}
}
}
} # end if ZM_LOG_DATABASE_LIMIT
$loop = $continuous;
sleep( $Config{ZM_AUDIT_CHECK_INTERVAL} ) if $continuous;