Merge branch 'merge_db_connects' into storageareas

This commit is contained in:
Isaac Connor 2016-05-09 12:26:17 -04:00
commit beebe74e7b
45 changed files with 130 additions and 11 deletions

View File

@ -1,9 +1,43 @@
zoneminder (1.28.1+1-vivid-SNAPSHOT2015081701) vivid; urgency=medium zoneminder (1.29.0+dfsg-1) unstable; urgency=low
* include api, switch to cmake build * New upstream release [February 2016] (Closes: #788317, #770851).
-- Isaac Connor <iconnor@connortechnology.com> Mon, 17 Aug 2015 10:29:23 -0400 [ Dmitry Smirnov <onlyjob@debian.org> ]
* copyright/Files-Excluded += "onvif/*" due to licensing uncertainty.
* Fixed FTBFS when built with dpkg-buildpackage -A (Closes: #806126).
* FFmpeg 2.9 support. Thanks, Andreas Cadhalpun. (Closes: #803850).
* Use "ffmpeg" instead of "avconv":
+ "libav_path.patch" replaced with "default_ffmpeg_path.patch".
* zoneminder/Depends:
- perl-modules (package-relation-with-perl-modules)
- libav-tools
* zoneminder/Recommends:
+ ffmpeg | libav-tools
* Updated Vcs URLs.
* Build/install new man pages.
* Removed obsolete lintian-overrides.
* README: grant "index" right to DB user.
* systemd: start after MySQL but do not require the latter.
* Added new patch with spelling corrections.
* Removed obsolete patches:
- 783.patch
- 980-fix-image-size.patch
- cmake-fix-confpath.patch
- cmake.patch
- cmake-gnutls.patch
- fix-html-export.patch
- format-hardening.patch
- libv4l1-videodev.h.patch
- pod_man_fixes.patch
- pod_name_fixes.patch
- pod_zmupdate-to-pod2usage.patch
- respect-privacy.patch
- zmtrigger-plus.patch
[ Vagrant Cascadian <vagrant@debian.org> ]
* Remove myself from Uploaders.
-- Dmitry Smirnov <onlyjob@debian.org> Tue, 09 Feb 2016 15:40:32 +1100
zoneminder (1.28.1-8) unstable; urgency=medium zoneminder (1.28.1-8) unstable; urgency=medium

View File

@ -5,11 +5,6 @@ Maintainer: Dmitry Smirnov <onlyjob@debian.org>
Uploaders: Vagrant Cascadian <vagrant@debian.org> Uploaders: Vagrant Cascadian <vagrant@debian.org>
Build-Depends: debhelper (>= 9), dh-systemd, python-sphinx | python3-sphinx, apache2-dev, dh-linktree Build-Depends: debhelper (>= 9), dh-systemd, python-sphinx | python3-sphinx, apache2-dev, dh-linktree
,cmake ,cmake
,libavcodec-ffmpeg-dev | libavcodec-dev
,libavformat-ffmpeg-dev | libavformat-dev
,libswscale-ffmpeg-dev | libswscale-dev
,libavutil-ffmpeg-dev | libavutil-dev
,libavdevice-ffmpeg-dev | libavdevice-dev
,libx264-dev, libmp4v2-dev ,libx264-dev, libmp4v2-dev
,libbz2-dev ,libbz2-dev
,libgcrypt-dev ,libgcrypt-dev
@ -65,9 +60,14 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, ${perl:Depends}
,rsyslog | system-log-daemon ,rsyslog | system-log-daemon
,zip ,zip
Recommends: ${misc:Recommends} Recommends: ${misc:Recommends}
<<<<<<< HEAD:distros/ubuntu1504/control
,libapache2-mod-php5 | libapache2-mod-php7 | php5-fpm ,libapache2-mod-php5 | libapache2-mod-php7 | php5-fpm
=======
,libapache2-mod-php5 | libapache2-mod-php | php5-fpm | php-fpm
>>>>>>> merge_db_connects:distros/ubuntu1604/control
,mysql-server | virtual-mysql-server ,mysql-server | virtual-mysql-server
,zoneminder-doc (>= ${source:Version}) ,zoneminder-doc (>= ${source:Version})
,ffmpeg
Suggests: fcgiwrap, logrotate Suggests: fcgiwrap, logrotate
Description: video camera security and surveillance solution Description: video camera security and surveillance solution
ZoneMinder is intended for use in single or multi-camera video security ZoneMinder is intended for use in single or multi-camera video security

View File

@ -81,6 +81,10 @@ our @EXPORT = ( @EXPORT_OK );
our $VERSION = $ZoneMinder::Base::VERSION; our $VERSION = $ZoneMinder::Base::VERSION;
BEGIN {
ZoneMinder::Config::zmConfigLoad();
ZoneMinder::Database::zmDbConnect();
}
1; 1;
__END__ __END__

View File

@ -30,6 +30,7 @@ use warnings;
require Exporter; require Exporter;
require ZoneMinder::Base; require ZoneMinder::Base;
require ZoneMinder::Database;
our @ISA = qw(Exporter ZoneMinder::Base); our @ISA = qw(Exporter ZoneMinder::Base);
@ -83,7 +84,6 @@ sub zmConfigLoad {
} }
close( $CONFIG ); close( $CONFIG );
require ZoneMinder::Database;
my $dbh = ZoneMinder::Database::zmDbConnect() or croak( "Can't connect to db" ); my $dbh = ZoneMinder::Database::zmDbConnect() or croak( "Can't connect to db" );
my $sql = 'select * from Config'; my $sql = 'select * from Config';
my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() ); my $sth = $dbh->prepare_cached( $sql ) or croak( "Can't prepare '$sql': ".$dbh->errstr() );

View File

@ -49,7 +49,7 @@ git submodule update --init --recursive
if [ $DISTRO == "trusty" ]; then if [ $DISTRO == "trusty" ]; then
ln -sf distros/ubuntu1204 debian ln -sf distros/ubuntu1204 debian
else else
ln -sf distros/ubuntu1504 debian ln -sf distros/ubuntu1604 debian
fi; fi;
# Auto-install all ZoneMinder's depedencies using the Debian control file # Auto-install all ZoneMinder's depedencies using the Debian control file

View File

@ -253,11 +253,20 @@ public function beforeFilter() {
} }
// format expected:
// you can changed AlarmFrames to any other named params
// consoleEvents/1 hour/AlarmFrames >=: 1/AlarmFrames <=: 20.json
public function consoleEvents($interval = null) { public function consoleEvents($interval = null) {
$this->Event->recursive = -1; $this->Event->recursive = -1;
$results = array(); $results = array();
$query = $this->Event->query("select MonitorId, COUNT(*) AS Count from Events WHERE StartTime >= (DATE_SUB(NOW(), interval $interval)) GROUP BY MonitorId;"); $moreconditions ="";
foreach ($this->request->params['named'] as $name => $param) {
$moreconditions = $moreconditions . " AND ".$name.$param;
}
$query = $this->Event->query("select MonitorId, COUNT(*) AS Count from Events WHERE (StartTime >= (DATE_SUB(NOW(), interval $interval)) $moreconditions) GROUP BY MonitorId;");
foreach ($query as $result) { foreach ($query as $result) {
$results[$result['Events']['MonitorId']] = $result[0]['Count']; $results[$result['Events']['MonitorId']] = $result[0]['Count'];

View File

@ -184,6 +184,78 @@ public function beforeFilter() {
)); ));
} }
// arm/disarm alarms
// expected format: http(s):/portal-api-url/monitors/alarm/id:M/command:C.json
// where M=monitorId
// where C=on|off
public function alarm()
{
$id = $this->request->params['named']['id'];
$cmd = strtolower($this->request->params['named']['command']);
if (!$this->Monitor->exists($id)) {
throw new NotFoundException(__('Invalid monitor'));
}
if ( $cmd != 'on' && $cmd != 'off')
{
throw new BadRequestException(__('Invalid command'));
}
if ($this->Session->Read('systemPermission') != 'Edit')
{
throw new UnauthorizedException(__('Insufficient privileges'));
return;
}
$zm_path_bin = Configure::read('ZM_PATH_BIN');
$q = ($cmd == 'on') ? '-a':'-c';
// form auth key based on auth credentials
$this->loadModel('Config');
$options = array('conditions' => array('Config.' . $this->Config->primaryKey => 'ZM_OPT_USE_AUTH'));
$config = $this->Config->find('first', $options);
$zmOptAuth = $config['Config']['Value'];
$options = array('conditions' => array('Config.' . $this->Config->primaryKey => 'ZM_AUTH_RELAY'));
$config = $this->Config->find('first', $options);
$zmAuthRelay = $config['Config']['Value'];
$auth="";
if ($zmOptAuth)
{
if ($zmAuthRelay == 'hashed')
{
$options = array('conditions' => array('Config.' . $this->Config->primaryKey => 'ZM_AUTH_HASH_SECRET'));
$config = $this->Config->find('first', $options);
$zmAuthHashSecret = $config['Config']['Value'];
$time = localtime();
$ak = $zmAuthHashSecret.$this->Session->Read('username').$this->Session->Read('passwordHash').$time[2].$time[3].$time[4].$time[5];
$ak = md5($ak);
$auth = " -A ".$ak;
}
elseif ($zmAuthRelay == 'plain')
{
$auth = " -U " .$this->Session->Read('username')." -P ".$this->Session->Read('password');
}
elseif ($zmAuthRelay == 'none')
{
$auth = " -U " .$this->Session->Read('username');
}
}
$shellcmd = escapeshellcmd("$zm_path_bin/zmu -v -m$id $q $auth");
$status = exec ($shellcmd);
$this->set(array(
'status' => $status,
'_serialize' => array('status'),
));
}
// Check if a daemon is running for the monitor id // Check if a daemon is running for the monitor id
public function daemonStatus() { public function daemonStatus() {
$id = $this->request->params['named']['id']; $id = $this->request->params['named']['id'];