Merge branch 'storageareas' of github.com:ZoneMinder/ZoneMinder into storageareas

This commit is contained in:
Isaac Connor 2016-01-04 14:38:37 -05:00
commit 69ddc7d34c
2 changed files with 12 additions and 126 deletions

View File

@ -179,7 +179,6 @@ MAIN: while( $loop ) {
Debug( "Got ".int(keys(%$db_events))." events\n" );
}
<<<<<<< HEAD
my $fs_monitors;
foreach my $Storage (
@ -318,131 +317,6 @@ MAIN: while( $loop ) {
}
}
} # end foreach Storage Area
=======
my $fs_monitors;
foreach my $monitor ( glob("[0-9]*") )
{
# Thie glob above gives all files starting with a digit. So a monitor with a name starting with a digit will be in this list.
next if $monitor =~ /\D/;
Debug( "Found filesystem monitor '$monitor'" );
my $fs_events = $fs_monitors->{$monitor} = {};
( my $monitor_dir ) = ( $monitor =~ /^(.*)$/ ); # De-taint
if ( $Config{ZM_USE_DEEP_STORAGE} )
{
foreach my $day_dir ( glob("$monitor_dir/*/*/*") )
{
Debug( "Checking $day_dir" );
( $day_dir ) = ( $day_dir =~ /^(.*)$/ ); # De-taint
chdir( $day_dir );
opendir( DIR, "." )
or Fatal( "Can't open directory '$day_dir': $!" );
my @event_links = sort { $b <=> $a } grep { -l $_ } readdir( DIR );
closedir( DIR );
my $count = 0;
foreach my $event_link ( @event_links )
{
Debug( "Checking link $event_link" );
( my $event = $event_link ) =~ s/^.*\.//;
my $event_path = readlink( $event_link );
if ( $count++ > MAX_AGED_DIRS )
{
$fs_events->{$event} = -1;
}
else
{
if ( !-e $event_path )
{
aud_print( "Event link $day_dir/$event_link does not point to valid target" );
if ( confirm() )
{
( $event_link ) = ( $event_link =~ /^(.*)$/ ); # De-taint
unlink( $event_link );
$cleaned = 1;
}
}
else
{
$fs_events->{$event} = (time() - ($^T - ((-M $event_path) * 24*60*60)));
}
}
}
chdir( EVENT_PATH );
}
}
else
{
chdir( $monitor_dir );
opendir( DIR, "." ) or Fatal( "Can't open directory '$monitor_dir': $!" );
my @temp_events = sort { $b <=> $a } grep { -d $_ && $_ =~ /^\d+$/ } readdir( DIR );
closedir( DIR );
my $count = 0;
foreach my $event ( @temp_events )
{
if ( $count++ > MAX_AGED_DIRS )
{
$fs_events->{$event} = -1;
}
else
{
$fs_events->{$event} = (time() - ($^T - ((-M $event) * 24*60*60)));
}
}
chdir( EVENT_PATH );
}
Debug( "Got ".int(keys(%$fs_events))." events\n" );
}
redo MAIN if ( $cleaned );
$cleaned = 0;
while ( my ( $fs_monitor, $fs_events ) = each(%$fs_monitors) )
{
if ( my $db_events = $db_monitors->{$fs_monitor} )
{
if ( $fs_events )
{
while ( my ( $fs_event, $age ) = each(%$fs_events ) )
{
if ( !defined($db_events->{$fs_event}) && ($age < 0 || ($age > $Config{ZM_AUDIT_MIN_AGE})) )
{
aud_print( "Filesystem event '$fs_monitor/$fs_event' does not exist in database" );
if ( confirm() )
{
deleteEventFiles( $fs_event, $fs_monitor );
$cleaned = 1;
}
}
}
}
}
else
{
aud_print( "Filesystem monitor '$fs_monitor' does not exist in database" );
if ( confirm() )
{
my $command = "rm -rf $fs_monitor";
executeShellCommand( $command );
$cleaned = 1;
}
}
}
my $monitor_links;
foreach my $link ( glob("*") )
{
next if ( !-l $link );
next if ( -e $link );
aud_print( "Filesystem monitor link '$link' does not point to valid monitor directory" );
if ( confirm() )
{
( $link ) = ( $link =~ /^(.*)$/ ); # De-taint
my $command = "rm $link";
executeShellCommand( $command );
$cleaned = 1;
}
}
>>>>>>> multi-server
redo MAIN if ( $cleaned );
$cleaned = 0;

View File

@ -80,5 +80,17 @@ class Monitor {
return( $streamSrc );
} // end function etStreamSrc
public function Width() {
if ( $this->Orientation() == '90' or $this->Orientation() == '270' ) {
return $this->{'Height'};
}
return $this->{'Width'};
}
public function Height() {
if ( $this->Orientation() == '90' or $this->Orientation() == '270' ) {
return $this->{'Width'};
}
return $this->{'Height'};
}
}
?>