Merge branch 'storageareas' of github.com:ConnorTechnology/ZoneMinder into storageareas
This commit is contained in:
commit
5472a1a012
|
@ -367,11 +367,11 @@ sub delete_files {
|
|||
Error("No monitor id assigned to event $$event{Id}");
|
||||
return;
|
||||
}
|
||||
my $event_path = $event->Path();
|
||||
Debug("Deleting files for Event $$event{Id} from $event_path.");
|
||||
my $event_path = $event->RelativePath();
|
||||
Debug("Deleting files for Event $$event{Id} from $storage_path/$event_path.");
|
||||
if ( $event_path ) {
|
||||
( $event_path ) = ( $event_path =~ /^(.*)$/ ); # De-taint
|
||||
my $command = "/bin/rm -rf $event_path";
|
||||
#( $event_path ) = ( $event_path =~ /^(.*)$/ ); # De-taint
|
||||
my $command = "/bin/rm -rf $storage_path/$event_path";
|
||||
ZoneMinder::General::executeShellCommand( $command );
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ sub delete_files {
|
|||
Debug("Deleting files for Event $$event{Id} from $storage_path/$link_path.");
|
||||
if ( $link_path ) {
|
||||
( $link_path ) = ( $link_path =~ /^(.*)$/ ); # De-taint
|
||||
unlink( $storage_path.'/'.$link_path ) or Error( "Unable to unlink '$storage_path/$link_path': $!" );
|
||||
unlink( $storage_path.'/'.$link_path ) or Error( "Unable to unlink '$storage_path/$link_path': $!" );
|
||||
}
|
||||
}
|
||||
} # end sub delete_files
|
||||
|
@ -395,11 +395,15 @@ sub Storage {
|
|||
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;
|
||||
if ( -e $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;
|
||||
} else {
|
||||
Warning("Path not found for Event $_[0]{Id} at $path");
|
||||
}
|
||||
}
|
||||
Debug("Checking for files for event $_[0]{Id} at $path using glob $path/* found no files");
|
||||
Debug("Checking for files for event $_[0]{Id} at $path using glob $path/* found no files");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -421,11 +425,15 @@ sub DiskSpace {
|
|||
$_[0]{DiskSpace} = $_[1];
|
||||
}
|
||||
if ( ! defined $_[0]{DiskSpace} ) {
|
||||
my $size = 0;
|
||||
File::Find::find( { wanted=>sub { $size += -f $_ ? -s _ : 0 }, untaint=>1 }, $_[0]->Path() );
|
||||
$_[0]{DiskSpace} = $size;
|
||||
Debug("DiskSpace for event $_[0]{Id} at $_[0]{Path} Updated to $size bytes");
|
||||
}
|
||||
if ( -e $_[0]->Path() ) {
|
||||
my $size = 0;
|
||||
File::Find::find( { wanted=>sub { $size += -f $_ ? -s _ : 0 }, untaint=>1 }, $_[0]->Path() );
|
||||
$_[0]{DiskSpace} = $size;
|
||||
Debug("DiskSpace for event $_[0]{Id} at $_[0]{Path} Updated to $size bytes");
|
||||
} else {
|
||||
Warning("Event does not exist at $_[0]{Path}");
|
||||
}
|
||||
} # end if ! defined DiskSpace
|
||||
}
|
||||
|
||||
sub MoveTo {
|
||||
|
|
|
@ -323,8 +323,10 @@ sub checkFilter {
|
|||
$ZoneMinder::Database::dbh->begin_work();
|
||||
$Event->lock_and_load();
|
||||
|
||||
$Event->DiskSpace(undef);
|
||||
$Event->save();
|
||||
my $old_diskspace = $$Event{DiskSpace};
|
||||
if ( $old_diskspace != $Event->DiskSpace(undef) ) {
|
||||
$Event->save();
|
||||
}
|
||||
$ZoneMinder::Database::dbh->commit();
|
||||
} # end if UpdateDiskSpace
|
||||
} # end foreach event
|
||||
|
|
|
@ -230,8 +230,8 @@ for( $monitor_i = 0; $monitor_i < count($displayMonitors); $monitor_i += 1 ) {
|
|||
} elseif ( $monitor['Type'] == 'File' || $monitor['Type'] == 'cURL' ) {
|
||||
$source = preg_replace( '/^.*\//', '', $monitor['Path'] );
|
||||
} elseif ( $monitor['Type'] == 'Ffmpeg' || $monitor['Type'] == 'Libvlc' ) {
|
||||
$domain = parse_url( $monitor['Path'], PHP_URL_HOST );
|
||||
$source = $domain ? $domain : preg_replace( '/^.*\//', '', $monitor['Path'] );
|
||||
$url_parts = parse_url( $monitor['Path'] );
|
||||
$source = $url_parts['host']. ( $url_parts['port'] ? ':'.$url_parts['port'] : '' );
|
||||
}
|
||||
if ( $source == '' ) {
|
||||
$source = 'Monitor ' . $monitor['Id'];
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'Events' ) ) {
|
||||
if ( !canView('Events') ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
@ -107,6 +107,7 @@ if ( ! $Event->Id() ) {
|
|||
?>
|
||||
<div id="dataBar">
|
||||
<span id="dataId" title="<?php echo translate('Id') ?>"><?php echo $Event->Id() ?></span>
|
||||
<span id="dataMonitor" title="<?php echo translate('Monitor') ?>"><?php echo $Monitor->Id() . ' ' . $Monitor->Name() ?></span>
|
||||
<span id="dataCause" title="<?php echo $Event->Notes()?validHtmlStr($Event->Notes()):translate('AttrCause') ?>"><?php echo validHtmlStr($Event->Cause()) ?></span>
|
||||
<span id="dataTime" title="<?php echo translate('Time') ?>"><?php echo strftime( STRF_FMT_DATETIME_SHORT, strtotime($Event->StartTime() ) ) ?></span>
|
||||
<span id="dataDuration" title="<?php echo translate('Duration') ?>"><?php echo $Event->Length().'s' ?></span>
|
||||
|
|
|
@ -68,8 +68,8 @@ if (isset($_REQUEST['minTime']) && isset($_REQUEST['maxTime']) && count($display
|
|||
)
|
||||
),
|
||||
);
|
||||
if (count($selected_monitor_ids ) ) {
|
||||
$filter['Query']['terms'][] = (array('attr' => 'MonitorId', 'op' => 'IN', 'val' => $selected_monitor_ids, 'cnj' => 'and'));
|
||||
if (count($selected_monitor_ids) ) {
|
||||
$filter['Query']['terms'][] = (array('attr' => 'MonitorId', 'op' => 'IN', 'val' => implode(',',$selected_monitor_ids), 'cnj' => 'and'));
|
||||
} else if ( ( $group_id != 0 || isset($_SESSION['ServerFilter']) || isset($_SESSION['StorageFilter']) || isset($_SESSION['StatusFilter']) ) ) {
|
||||
for ($i=0; $i < count($displayMonitors); $i++) {
|
||||
if ($i == '0') {
|
||||
|
|
Loading…
Reference in New Issue