Merge branch 'storageareas' into tesla
This commit is contained in:
commit
5a7ca38a1f
|
@ -209,11 +209,12 @@ CREATE TABLE `Events` (
|
||||||
`StateId` int(10) unsigned NOT NULL,
|
`StateId` int(10) unsigned NOT NULL,
|
||||||
`Orientation` enum('0','90','180','270','hori','vert') NOT NULL default '0',
|
`Orientation` enum('0','90','180','270','hori','vert') NOT NULL default '0',
|
||||||
`DiskSpace` bigint unsigned default NULL,
|
`DiskSpace` bigint unsigned default NULL,
|
||||||
PRIMARY KEY (`Id`,`MonitorId`),
|
PRIMARY KEY (`Id`),
|
||||||
KEY `MonitorId` (`MonitorId`),
|
KEY `MonitorId` (`MonitorId`),
|
||||||
KEY `StartTime` (`StartTime`),
|
KEY `StartTime` (`StartTime`),
|
||||||
KEY `Frames` (`Frames`),
|
KEY `Frames` (`Frames`),
|
||||||
KEY `Archived` (`Archived`)
|
KEY `Archived` (`Archived`),
|
||||||
|
KEY `EndTime_DiskSpace` (`EndTime`,`DiskSpace`)
|
||||||
) ENGINE=@ZM_MYSQL_ENGINE@;
|
) ENGINE=@ZM_MYSQL_ENGINE@;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
@ -669,7 +670,25 @@ insert into Users VALUES (NULL,'admin',password('admin'),'',1,'View','Edit','Edi
|
||||||
--
|
--
|
||||||
-- Add a sample filter to purge the oldest 100 events when the disk is 95% full
|
-- Add a sample filter to purge the oldest 100 events when the disk is 95% full
|
||||||
--
|
--
|
||||||
insert into Filters values (NULL,'PurgeWhenFull','{"sort_field":"Id","terms":[{"val":0,"attr":"Archived","op":"="},{"cnj":"and","val":95,"attr":"DiskPercent","op":">="}],"limit":100,"sort_asc":1}',0,0,0,0,0,0,'',1,0,1,0);
|
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||||
|
`Name` varchar(64) NOT NULL default '',
|
||||||
|
`Query` text NOT NULL,
|
||||||
|
`AutoArchive` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`AutoVideo` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`AutoUpload` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`AutoEmail` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`AutoMessage` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`AutoExecute` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`AutoExecuteCmd` tinytext,
|
||||||
|
`AutoDelete` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`AutoMove` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`AutoMoveTo` smallint(5) unsigned NOT NULL default 0,
|
||||||
|
`UpdateDiskSpace` tinyint(3) unsigned NOT NULL default '0',
|
||||||
|
`Background` tinyint(1) unsigned NOT NULL default '0',
|
||||||
|
`Concurrent` tinyint(1) unsigned NOT NULL default '0',
|
||||||
|
|
||||||
|
insert into Filters values (NULL,'PurgeWhenFull','{"sort_field":"Id","terms":[{"val":0,"attr":"Archived","op":"="},{"cnj":"and","val":95,"attr":"DiskPercent","op":">="}],"limit":100,"sort_asc":1}',0/*AutoArchive*/,0/*AutoVideo*/,0/*AutoUpload*/,0/*AutoEmail*/,0/*AutoMessage*/,0/*AutoExecute*/,'',1/*AutoDelete*/,0/*AutoMove*/,0/*MoveTo*/,0/*UpdateDiskSpace*/,1/*Background*/,0/*Concurrent*/);
|
||||||
|
insert into Filters values (NULL,'Update DiskSpace','{"terms":[{"attr":"DiskSpace","op":"IS","val":"NULL"}]}',0,0,0,0,0,0,'',0,0,0,1,1,0);
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Add in some sample control protocol definitions
|
-- Add in some sample control protocol definitions
|
||||||
|
|
|
@ -10,3 +10,14 @@ SET @s = (SELECT IF(
|
||||||
|
|
||||||
PREPARE stmt FROM @s;
|
PREPARE stmt FROM @s;
|
||||||
EXECUTE stmt;
|
EXECUTE stmt;
|
||||||
|
|
||||||
|
SET @s = (SELECT IF(
|
||||||
|
(SELECT COUNT(*) FROM Filters WHERE Name = 'Update DiskSpace'
|
||||||
|
AND Query = '{"terms":[{"attr":"DiskSpace","op":"IS","val":"NULL"}]}'
|
||||||
|
) > 0,
|
||||||
|
"SELECT 'Update Disk Space Filter already exists.'",
|
||||||
|
"INSERT INTO Filters (Name,Query,UpdateDiskSpace,Background) values ('Update DiskSpace','{\"terms\":[{\"attr\":\"DiskSpace\",\"op\":\"IS\",\"val\":\"NULL\"}]}',1,1)"
|
||||||
|
));
|
||||||
|
|
||||||
|
PREPARE stmt FROM @s;
|
||||||
|
EXECUTE stmt;
|
||||||
|
|
|
@ -238,8 +238,13 @@ MAIN: while( $loop ) {
|
||||||
} elsif ( $$Storage{Scheme} eq 'Medium' ) {
|
} elsif ( $$Storage{Scheme} eq 'Medium' ) {
|
||||||
foreach my $event_dir ( glob("$monitor_dir/*/*") ) {
|
foreach my $event_dir ( glob("$monitor_dir/*/*") ) {
|
||||||
next if ! -d $event_dir;
|
next if ! -d $event_dir;
|
||||||
my $Event = $fs_events->{$event} = new ZoneMinder::Event();
|
my ( $date, $event_id ) = $event_dir =~ /^$monitor_dir\/(\d{4}\-\d{2}\-\d{2})\/(\d\+)$/;
|
||||||
$$Event{Id} = $event;
|
if ( ! $event_id ) {
|
||||||
|
Debug("Unable to parse date/event_id from $event_dir");
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
my $Event = $fs_events->{$event_id} = new ZoneMinder::Event();
|
||||||
|
$$Event{Id} = $event_id;
|
||||||
$$Event{Path} = $event_dir;
|
$$Event{Path} = $event_dir;
|
||||||
$Event->MonitorId( $monitor_dir );
|
$Event->MonitorId( $monitor_dir );
|
||||||
$Event->StorageId( $Storage->Id() );
|
$Event->StorageId( $Storage->Id() );
|
||||||
|
|
|
@ -142,6 +142,27 @@ foreach( $configvals as $key => $value) {
|
||||||
Configure::write( $key, $value );
|
Configure::write( $key, $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For Human-readability, use ZM_SERVER_HOST or ZM_SERVER_NAME in zm.conf, and convert it here to a ZM_SERVER_ID
|
||||||
|
if ( ! defined('ZM_SERVER_ID') ) {
|
||||||
|
App::uses('ClassRegistry', 'Utility');
|
||||||
|
$ServerModel = ClassRegistry::init('Server');
|
||||||
|
if ( defined('ZM_SERVER_NAME') and ZM_SERVER_NAME ) {
|
||||||
|
$Server = $ServerModel->find( 'first', array( 'conditions'=>array('Name'=>ZM_SERVER_NAME) ) );
|
||||||
|
if ( ! $Server ) {
|
||||||
|
Error('Invalid Multi-Server configration detected. ZM_SERVER_NAME set to ' . ZM_SERVER_NAME . ' in zm.conf, but no corresponding entry found in Servers table.');
|
||||||
|
} else {
|
||||||
|
define( 'ZM_SERVER_ID', $Server['Server']['Id'] );
|
||||||
|
}
|
||||||
|
} else if ( defined('ZM_SERVER_HOST') and ZM_SERVER_HOST ) {
|
||||||
|
$Server = $ServerModel->find( 'first', array( 'conditions'=>array('Name'=>ZM_SERVER_HOST) ) );
|
||||||
|
if ( ! $Server ) {
|
||||||
|
Error('Invalid Multi-Server configration detected. ZM_SERVER_HOST set to ' . ZM_SERVER_HOST . ' in zm.conf, but no corresponding entry found in Servers table.');
|
||||||
|
} else {
|
||||||
|
define( 'ZM_SERVER_ID', $Server['Server']['Id'] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function process_configfile($configFile) {
|
function process_configfile($configFile) {
|
||||||
if ( is_readable( $configFile ) ) {
|
if ( is_readable( $configFile ) ) {
|
||||||
$configvals = array();
|
$configvals = array();
|
||||||
|
|
Loading…
Reference in New Issue