Merge branch 'master' into filter_locking
This commit is contained in:
commit
858674c0b2
|
@ -316,6 +316,7 @@ DROP TABLE IF EXISTS `Frames`;
|
||||||
CREATE TABLE `Frames` (
|
CREATE TABLE `Frames` (
|
||||||
`Id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
`Id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
`EventId` BIGINT UNSIGNED NOT NULL default '0',
|
`EventId` BIGINT UNSIGNED NOT NULL default '0',
|
||||||
|
FOREIGN KEY (`EventId`) REFERENCES `Events` (`Id`) ON DELETE CASCADE,
|
||||||
`FrameId` int(10) unsigned NOT NULL default '0',
|
`FrameId` int(10) unsigned NOT NULL default '0',
|
||||||
`Type` enum('Normal','Bulk','Alarm') NOT NULL default 'Normal',
|
`Type` enum('Normal','Bulk','Alarm') NOT NULL default 'Normal',
|
||||||
`TimeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
`TimeStamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||||||
|
@ -609,8 +610,11 @@ DROP TABLE IF EXISTS `Stats`;
|
||||||
CREATE TABLE `Stats` (
|
CREATE TABLE `Stats` (
|
||||||
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
`Id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||||
`MonitorId` int(10) unsigned NOT NULL default '0',
|
`MonitorId` int(10) unsigned NOT NULL default '0',
|
||||||
|
FOREIGN KEY (`MonitorId`) REFERENCES `Monitors` (`Id`) ON DELETE CASCADE,
|
||||||
`ZoneId` int(10) unsigned NOT NULL default '0',
|
`ZoneId` int(10) unsigned NOT NULL default '0',
|
||||||
|
FOREIGN KEY (`ZoneId`) REFERENCES `Zones` (`Id`) ON DELETE CASCADE,
|
||||||
`EventId` BIGINT UNSIGNED NOT NULL,
|
`EventId` BIGINT UNSIGNED NOT NULL,
|
||||||
|
FOREIGN KEY (`EventId`) REFERENCES `Events` (`Id`) ON DELETE CASCADE,
|
||||||
`FrameId` int(10) unsigned NOT NULL default '0',
|
`FrameId` int(10) unsigned NOT NULL default '0',
|
||||||
`PixelDiff` tinyint(3) unsigned NOT NULL default '0',
|
`PixelDiff` tinyint(3) unsigned NOT NULL default '0',
|
||||||
`AlarmPixels` int(10) unsigned NOT NULL default '0',
|
`AlarmPixels` int(10) unsigned NOT NULL default '0',
|
||||||
|
@ -705,6 +709,7 @@ DROP TABLE IF EXISTS `Zones`;
|
||||||
CREATE TABLE `Zones` (
|
CREATE TABLE `Zones` (
|
||||||
`Id` int(10) unsigned NOT NULL auto_increment,
|
`Id` int(10) unsigned NOT NULL auto_increment,
|
||||||
`MonitorId` int(10) unsigned NOT NULL default '0',
|
`MonitorId` int(10) unsigned NOT NULL default '0',
|
||||||
|
FOREIGN KEY (`MonitorId`) REFERENCES `Monitors` (`Id`) ON DELETE CASCADE,
|
||||||
`Name` varchar(64) NOT NULL default '',
|
`Name` varchar(64) NOT NULL default '',
|
||||||
`Type` enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Privacy') NOT NULL default 'Active',
|
`Type` enum('Active','Inclusive','Exclusive','Preclusive','Inactive','Privacy') NOT NULL default 'Active',
|
||||||
`Units` enum('Pixels','Percent') NOT NULL default 'Pixels',
|
`Units` enum('Pixels','Percent') NOT NULL default 'Pixels',
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
--
|
/* Change Id type to BIGINT. */
|
||||||
-- Update Filters table to have a LockRows Column
|
ALTER TABLE Events MODIFY Id bigint unsigned NOT NULL auto_increment;
|
||||||
--
|
|
||||||
|
|
||||||
SELECT 'Checking for LockRows in Filters';
|
/* Add FOREIGN KEYS After deleting lost records */
|
||||||
SET @s = (SELECT IF(
|
DELETE FROM Frames WHERE EventId NOT IN (SELECT Id FROM Events);
|
||||||
(SELECT COUNT(*)
|
ALTER TABLE Frames ADD FOREIGN KEY (EventId) REFERENCES Events (Id) ON DELETE CASCADE;
|
||||||
FROM INFORMATION_SCHEMA.COLUMNS
|
|
||||||
WHERE table_name = 'Filters'
|
|
||||||
AND table_schema = DATABASE()
|
|
||||||
AND column_name = 'LockRows'
|
|
||||||
) > 0,
|
|
||||||
"SELECT 'Column LockRows already exists in Filters'",
|
|
||||||
"ALTER TABLE Filters ADD COLUMN `LockRows` tinyint(1) unsigned NOT NULL default '0' AFTER `Concurrent`"
|
|
||||||
));
|
|
||||||
|
|
||||||
PREPARE stmt FROM @s;
|
/* Add FOREIGN KEYS After deleting lost records */
|
||||||
EXECUTE stmt;
|
DELETE FROM Stats WHERE EventId NOT IN (SELECT Id FROM Events);
|
||||||
|
ALTER TABLE Stats ADD FOREIGN KEY (EventId) REFERENCES Events (Id) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
DELETE FROM Stats WHERE MonitorId NOT IN (SELECT Id FROM Monitors);
|
||||||
|
ALTER TABLE Stats ADD FOREIGN KEY (`MonitorId`) REFERENCES `Monitors` (`Id`) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
DELETE FROM Stats WHERE ZoneId NOT IN (SELECT Id FROM Zones);
|
||||||
|
ALTER TABLE Stats ADD FOREIGN KEY (`ZoneId`) REFERENCES `Zones` (`Id`) ON DELETE CASCADE;
|
||||||
|
|
||||||
|
/* Add FOREIGN KEYS After deleting lost records */
|
||||||
|
DELETE FROM Zones WHERE MonitorId NOT IN (SELECT Id FROM Monitors);
|
||||||
|
ALTER TABLE Zones ADD FOREIGN KEY (`MonitorId`) REFERENCES `Monitors` (`Id`) ON DELETE CASCADE;
|
||||||
|
|
|
@ -39,9 +39,9 @@ if [ "$1" = "configure" ]; then
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
# This creates the user.
|
# This creates the user.
|
||||||
echo "grant lock tables, alter,drop,select,insert,update,delete,create,index,alter routine,create routine, trigger,execute on ${ZM_DB_NAME}.* to '${ZM_DB_USER}'@localhost identified by \"${ZM_DB_PASS}\";" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
echo "grant lock tables, alter,drop,select,insert,update,delete,create,index,alter routine,create routine, trigger,execute, REFERENCES on ${ZM_DB_NAME}.* to '${ZM_DB_USER}'@localhost identified by \"${ZM_DB_PASS}\";" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||||
else
|
else
|
||||||
echo "grant lock tables, alter,drop,select,insert,update,delete,create,index,alter routine,create routine, trigger,execute on ${ZM_DB_NAME}.* to '${ZM_DB_USER}'@localhost;" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
echo "grant lock tables, alter,drop,select,insert,update,delete,create,index,alter routine,create routine, trigger,execute, REFERENCES on ${ZM_DB_NAME}.* to '${ZM_DB_USER}'@localhost;" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||||
fi
|
fi
|
||||||
|
|
||||||
zmupdate.pl --nointeractive
|
zmupdate.pl --nointeractive
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
%global _hardened_build 1
|
%global _hardened_build 1
|
||||||
|
|
||||||
Name: zoneminder
|
Name: zoneminder
|
||||||
Version: 1.35.10
|
Version: 1.35.11
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: A camera monitoring and analysis tool
|
Summary: A camera monitoring and analysis tool
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
|
|
|
@ -68,7 +68,7 @@ if [ "$1" = "configure" ]; then
|
||||||
echo "CREATE USER '${ZM_DB_USER}'@localhost IDENTIFIED BY '${ZM_DB_PASS}';" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
echo "CREATE USER '${ZM_DB_USER}'@localhost IDENTIFIED BY '${ZM_DB_PASS}';" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||||
fi
|
fi
|
||||||
echo "Updating permissions"
|
echo "Updating permissions"
|
||||||
echo "grant lock tables,alter,drop,select,insert,update,delete,create,index,alter routine,create routine, trigger,execute on ${ZM_DB_NAME}.* to '${ZM_DB_USER}'@localhost;" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
echo "GRANT LOCK TABLES,ALTER,DROP,SELECT,INSERT,UPDATE,DELETE,CREATE,INDEX,ALTER ROUTINE,CREATE ROUTINE, TRIGGER,EXECUTE,REFERENCES ON ${ZM_DB_NAME}.* TO '${ZM_DB_USER}'@localhost;" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||||
|
|
||||||
zmupdate.pl --nointeractive
|
zmupdate.pl --nointeractive
|
||||||
zmupdate.pl --nointeractive -f
|
zmupdate.pl --nointeractive -f
|
||||||
|
|
|
@ -26,7 +26,7 @@ create_update_user () {
|
||||||
echo "CREATE USER '${ZM_DB_USER}'@${ZM_DB_HOST} IDENTIFIED BY '${ZM_DB_PASS}';" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
echo "CREATE USER '${ZM_DB_USER}'@${ZM_DB_HOST} IDENTIFIED BY '${ZM_DB_PASS}';" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||||
fi
|
fi
|
||||||
echo "Updating permissions"
|
echo "Updating permissions"
|
||||||
echo "GRANT LOCK tables,alter,drop,select,insert,update,delete,create,index,alter routine,create routine,trigger,execute ON ${ZM_DB_NAME}.* TO '${ZM_DB_USER}'@${ZM_DB_HOST};" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
echo "GRANT LOCK tables,alter,drop,select,insert,update,delete,create,index,alter routine,create routine,trigger,execute,REFERENCES ON ${ZM_DB_NAME}.* TO '${ZM_DB_USER}'@${ZM_DB_HOST};" | mysql --defaults-file=/etc/mysql/debian.cnf mysql
|
||||||
}
|
}
|
||||||
|
|
||||||
update_db () {
|
update_db () {
|
||||||
|
|
|
@ -664,7 +664,6 @@ int FfmpegCamera::OpenFfmpeg() {
|
||||||
} // int FfmpegCamera::OpenFfmpeg()
|
} // int FfmpegCamera::OpenFfmpeg()
|
||||||
|
|
||||||
int FfmpegCamera::Close() {
|
int FfmpegCamera::Close() {
|
||||||
Debug(2, "CloseFfmpeg called.");
|
|
||||||
|
|
||||||
mCanCapture = false;
|
mCanCapture = false;
|
||||||
|
|
||||||
|
|
|
@ -155,11 +155,11 @@ function queryRequest($filter, $search, $advsearch, $sort, $offset, $order, $lim
|
||||||
|
|
||||||
foreach ( $advsearch as $col=>$text ) {
|
foreach ( $advsearch as $col=>$text ) {
|
||||||
if ( in_array($col, $columns) ) {
|
if ( in_array($col, $columns) ) {
|
||||||
$text = '%' .$text. '%';
|
//$text = '%' .$text. '%';
|
||||||
array_push($likes, 'E.'.$col.' LIKE ?');
|
array_push($likes, 'E.'.$col.' LIKE ?');
|
||||||
array_push($query['values'], $text);
|
array_push($query['values'], $text);
|
||||||
} else if ( in_array($col, $col_alt) ) {
|
} else if ( in_array($col, $col_alt) ) {
|
||||||
$text = '%' .$text. '%';
|
//$text = '%' .$text. '%';
|
||||||
array_push($likes, 'M.'.$col.' LIKE ?');
|
array_push($likes, 'M.'.$col.' LIKE ?');
|
||||||
array_push($query['values'], $text);
|
array_push($query['values'], $text);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -6,6 +6,7 @@ if ( $_REQUEST['entity'] == 'navBar' ) {
|
||||||
$auth_hash = generateAuthHash(ZM_AUTH_HASH_IPS);
|
$auth_hash = generateAuthHash(ZM_AUTH_HASH_IPS);
|
||||||
if ( isset($_REQUEST['auth']) and ($_REQUEST['auth'] != $auth_hash) ) {
|
if ( isset($_REQUEST['auth']) and ($_REQUEST['auth'] != $auth_hash) ) {
|
||||||
$data['auth'] = $auth_hash;
|
$data['auth'] = $auth_hash;
|
||||||
|
$data['auth_relay'] = get_auth_relay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Each widget on the navbar has its own function
|
// Each widget on the navbar has its own function
|
||||||
|
|
|
@ -408,10 +408,10 @@ class Logger {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$message = $code.' ['.$string.']';
|
|
||||||
if ( $level <= $this->syslogLevel )
|
if ( $level <= $this->syslogLevel )
|
||||||
syslog( self::$syslogPriorities[$level], $message );
|
syslog(self::$syslogPriorities[$level], $message);
|
||||||
|
|
||||||
|
$message = $code.' ['.$string.']';
|
||||||
if ( $level <= $this->databaseLevel ) {
|
if ( $level <= $this->databaseLevel ) {
|
||||||
try {
|
try {
|
||||||
global $dbConn;
|
global $dbConn;
|
||||||
|
|
|
@ -372,10 +372,14 @@ if ( currentView != 'none' && currentView != 'login' ) {
|
||||||
}
|
}
|
||||||
if ( data.auth ) {
|
if ( data.auth ) {
|
||||||
if ( data.auth != auth_hash ) {
|
if ( data.auth != auth_hash ) {
|
||||||
|
console.log("Update auth_hash to "+data.auth);
|
||||||
// Update authentication token.
|
// Update authentication token.
|
||||||
auth_hash = data.auth;
|
auth_hash = data.auth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( data.auth_relay ) {
|
||||||
|
auth_relay = data.auth_relay;
|
||||||
|
}
|
||||||
// iterate through all the keys then update each element id with the same name
|
// iterate through all the keys then update each element id with the same name
|
||||||
for (var key of Object.keys(data)) {
|
for (var key of Object.keys(data)) {
|
||||||
if ( key == "auth" ) continue;
|
if ( key == "auth" ) continue;
|
||||||
|
|
|
@ -135,7 +135,7 @@ function manageDelConfirmModalBtns() {
|
||||||
$j.getJSON(thisUrl + '?request=events&task=delete&eids[]='+selections.join('&eids[]='))
|
$j.getJSON(thisUrl + '?request=events&task=delete&eids[]='+selections.join('&eids[]='))
|
||||||
.done( function(data) {
|
.done( function(data) {
|
||||||
$j('#eventTable').bootstrapTable('refresh');
|
$j('#eventTable').bootstrapTable('refresh');
|
||||||
window.location.reload(true);
|
$j('#deleteConfirm').modal('hide');
|
||||||
})
|
})
|
||||||
.fail(logAjaxFail);
|
.fail(logAjaxFail);
|
||||||
});
|
});
|
||||||
|
@ -238,7 +238,6 @@ function initPage() {
|
||||||
$j.getJSON(thisUrl + '?request=events&task=archive&eids[]='+selections.join('&eids[]='))
|
$j.getJSON(thisUrl + '?request=events&task=archive&eids[]='+selections.join('&eids[]='))
|
||||||
.done( function(data) {
|
.done( function(data) {
|
||||||
$j('#eventTable').bootstrapTable('refresh');
|
$j('#eventTable').bootstrapTable('refresh');
|
||||||
window.location.reload(true);
|
|
||||||
})
|
})
|
||||||
.fail(logAjaxFail);
|
.fail(logAjaxFail);
|
||||||
});
|
});
|
||||||
|
@ -257,11 +256,8 @@ function initPage() {
|
||||||
$j.getJSON(thisUrl + '?request=events&task=unarchive&eids[]='+selections.join('&eids[]='))
|
$j.getJSON(thisUrl + '?request=events&task=unarchive&eids[]='+selections.join('&eids[]='))
|
||||||
.done( function(data) {
|
.done( function(data) {
|
||||||
$j('#eventTable').bootstrapTable('refresh');
|
$j('#eventTable').bootstrapTable('refresh');
|
||||||
window.location.reload(true);
|
|
||||||
})
|
})
|
||||||
.fail(logAjaxFail);
|
.fail(logAjaxFail);
|
||||||
|
|
||||||
//window.location.reload(true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Manage the EDIT button
|
// Manage the EDIT button
|
||||||
|
|
|
@ -74,35 +74,32 @@ function validateForm(form) {
|
||||||
|
|
||||||
function updateButtons(element) {
|
function updateButtons(element) {
|
||||||
var form = element.form;
|
var form = element.form;
|
||||||
if ( element.type == 'checkbox' && element.checked ) {
|
|
||||||
form.elements['executeButton'].disabled = false;
|
var canExecute = false;
|
||||||
} else {
|
if ( form.elements['filter[AutoArchive]'] && form.elements['filter[AutoArchive]'].checked ) {
|
||||||
var canExecute = false;
|
canExecute = true;
|
||||||
if ( form.elements['filter[AutoArchive]'] && form.elements['filter[AutoArchive]'].checked ) {
|
} else if ( form.elements['filter[AutoUnarchive]'] && form.elements['filter[AutoUnarchive]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoUnarchive]'] && form.elements['filter[AutoUnarchive]'].checked ) {
|
} else if ( form.elements['filter[AutoCopy]'] && form.elements['filter[AutoCopy]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoCopy]'] && form.elements['filter[AutoCopy]'].checked ) {
|
} else if ( form.elements['filter[AutoMove]'] && form.elements['filter[AutoMove]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoMove]'] && form.elements['filter[AutoMove]'].checked ) {
|
} else if ( form.elements['filter[AutoVideo]'] && form.elements['filter[AutoVideo]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoVideo]'] && form.elements['filter[AutoVideo]'].checked ) {
|
} else if ( form.elements['filter[AutoUpload]'] && form.elements['filter[AutoUpload]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoUpload]'] && form.elements['filter[AutoUpload]'].checked ) {
|
} else if ( form.elements['filter[AutoEmail]'] && form.elements['filter[AutoEmail]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoEmail]'] && form.elements['filter[AutoEmail]'].checked ) {
|
} else if ( form.elements['filter[AutoMessage]'] && form.elements['filter[AutoMessage]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoMessage]'] && form.elements['filter[AutoMessage]'].checked ) {
|
} else if ( form.elements['filter[AutoExecute]'].checked && form.elements['filter[AutoExecuteCmd]'].value != '' ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoExecute]'].checked && form.elements['filter[AutoExecuteCmd]'].value != '' ) {
|
} else if ( form.elements['filter[AutoDelete]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[AutoDelete]'].checked ) {
|
} else if ( form.elements['filter[UpdateDiskSpace]'].checked ) {
|
||||||
canExecute = true;
|
canExecute = true;
|
||||||
} else if ( form.elements['filter[UpdateDiskSpace]'].checked ) {
|
|
||||||
canExecute = true;
|
|
||||||
}
|
|
||||||
form.elements['executeButton'].disabled = !canExecute;
|
|
||||||
}
|
}
|
||||||
|
form.elements['executeButton'].disabled = !canExecute;
|
||||||
if ( form.elements['filter[Name]'].value ) {
|
if ( form.elements['filter[Name]'].value ) {
|
||||||
form.elements['Save'].disabled = false;
|
form.elements['Save'].disabled = false;
|
||||||
form.elements['SaveAs'].disabled = false;
|
form.elements['SaveAs'].disabled = false;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var ZM_OPT_USE_GEOLOCATION = '<?php echo ZM_OPT_USE_GEOLOCATION ?>';
|
var ZM_OPT_USE_GEOLOCATION = '<?php echo ZM_OPT_USE_GEOLOCATION ?>' == '1' ? true : false;
|
||||||
<?php
|
<?php
|
||||||
if ( ZM_OPT_USE_GEOLOCATION ) {
|
if ( ZM_OPT_USE_GEOLOCATION ) {
|
||||||
echo 'var ZM_OPT_GEOLOCATION_TILE_PROVIDER=\''.ZM_OPT_GEOLOCATION_TILE_PROVIDER.'\''.PHP_EOL;
|
echo 'var ZM_OPT_GEOLOCATION_TILE_PROVIDER=\''.ZM_OPT_GEOLOCATION_TILE_PROVIDER.'\''.PHP_EOL;
|
||||||
|
|
Loading…
Reference in New Issue