Skip to content

Commit

Permalink
remove ZM_DIR_IMAGES (#2374)
Browse files Browse the repository at this point in the history
  • Loading branch information
knight-of-ni authored and connortechnology committed Dec 29, 2018
1 parent 03e0be5 commit 3258d8e
Show file tree
Hide file tree
Showing 22 changed files with 10 additions and 101 deletions.
4 changes: 0 additions & 4 deletions CMakeLists.txt
Expand Up @@ -162,9 +162,6 @@ set(ZM_WEB_GROUP "" CACHE STRING
Leave empty to be the same as the web user")
set(ZM_DIR_EVENTS "${ZM_CONTENTDIR}/events" CACHE PATH
"Location where events are recorded to, default: ZM_CONTENTDIR/events")
set(ZM_DIR_IMAGES "${ZM_CONTENTDIR}/images" CACHE PATH
"Location where images, not directly associated with events,
are recorded to, default: ZM_CONTENTDIR/images")
set(ZM_DIR_SOUNDS "sounds" CACHE PATH
"Location to look for optional sound files, default: sounds")
set(ZM_PATH_ZMS "/cgi-bin/nph-zms" CACHE PATH
Expand Down Expand Up @@ -225,7 +222,6 @@ if((ZM_TARGET_DISTRO MATCHES "^el") OR (ZM_TARGET_DISTRO MATCHES "^fc"))
set(ZM_WEBDIR "/usr/share/zoneminder/www")
set(ZM_CGIDIR "/usr/libexec/zoneminder/cgi-bin")
set(ZM_DIR_EVENTS "/var/lib/zoneminder/events")
set(ZM_DIR_IMAGES "/var/lib/zoneminder/images")
set(ZM_PATH_ZMS "/cgi-bin-zm/nph-zms")
elseif(ZM_TARGET_DISTRO STREQUAL "OS13")
set(ZM_RUNDIR "/var/run/zoneminder")
Expand Down
5 changes: 2 additions & 3 deletions INSTALL
Expand Up @@ -51,7 +51,6 @@ Possible configuration options:
ZM_WEB_USER The user apache or the local web server runs on. Leave empty for automatic detection. If that fails, you can use this variable to force
ZM_WEB_GROUP The group apache or the local web server runs on, Leave empty to be the same as the web user
ZM_DIR_EVENTS Location where events are recorded to, default: ZM_CONTENTDIR/events
ZM_DIR_IMAGES Location where images, not directly associated with events, are recorded to, default: ZM_CONTENTDIR/images
ZM_DIR_SOUNDS Location to look for optional sound files, default: sounds
ZM_PATH_ZMS Web url to zms streaming server, default: /cgi-bin/nph-zms
Advanced:
Expand Down Expand Up @@ -129,8 +128,8 @@ cmake -C zm_conf.cmake [extra options] .

2) Run "make" to compile ZoneMinder
3) Run "make install" (as root, or use sudo) to install ZoneMinder to your system.
4) Depending on your configuration: If the DIR_EVENTS and DIR_IMAGES options are set to default (pointing to web directory/events and web directory/images), You will need to update the symlinks in the web directory to the correct folders. e.g. web directory/events should point to the real events directory, and likewise for the images directory.
You can use the zmlinkcontent.sh script for this. For example, if /var/lib/zoneminder is the folder that contains the "images" and "events" directories, you can use:
4) Depending on your configuration: If DIR_EVENTS is set to default, You will need to update the symlinks in the web directory to the correct folders. e.g. web directory/events should point to the real events directory.
You can use the zmlinkcontent.sh script for this. For example, if /var/lib/zoneminder is the folder that contains the "events" directory, you can use:
./zmlinkcontent.sh /var/lib/zoneminder
By default, the content directory for new installations is /var/lib/zoneminder. This can be overridden in cmake with the ZM_CONTENTDIR option. e.g. cmake -DZM_CONTENTDIR="/some/big/storage/zm" .

Expand Down
5 changes: 0 additions & 5 deletions conf.d/01-system-paths.conf.in
Expand Up @@ -16,11 +16,6 @@
# The web account user must have full read/write permission to this folder.
ZM_DIR_EVENTS=@ZM_DIR_EVENTS@

# Full path to the folder images, not directly associated with events,
# are recorded to.
# The web account user must have full read/write permission to this folder.
ZM_DIR_IMAGES=@ZM_DIR_IMAGES@

# Foldername under the webroot where ZoneMinder looks for optional sound files
# to play when an alarm is detected.
ZM_DIR_SOUNDS=@ZM_DIR_SOUNDS@
Expand Down
1 change: 0 additions & 1 deletion distros/debian/rules
Expand Up @@ -24,7 +24,6 @@ override_dh_auto_configure:
-DZM_CONFIG_SUBDIR="/etc/zm/conf.d" \
-DZM_CONFIG_DIR="/etc/zm" \
-DZM_DIR_EVENTS="/var/cache/zoneminder/events" \
-DZM_DIR_IMAGES="/var/cache/zoneminder/images" \
-DZM_PATH_ZMS="/zm/cgi-bin/nph-zms"

override_dh_auto_install:
Expand Down
4 changes: 2 additions & 2 deletions distros/redhat/CMakeLists.txt
Expand Up @@ -21,7 +21,7 @@ endif(ZM_TARGET_DISTRO MATCHES "^el")
# Configure the common zoneminder files
configure_file(common/zoneminder.logrotate.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.logrotate @ONLY)
configure_file(common/zoneminder.service.in ${CMAKE_CURRENT_SOURCE_DIR}/zoneminder.service @ONLY)
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events images temp)
file(MAKE_DIRECTORY sock swap zoneminder zoneminder-upload events temp)

# Configure the Apache zoneminder files
configure_file(httpd/zm-httpd.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/zm-httpd.conf @ONLY)
Expand Down Expand Up @@ -52,7 +52,7 @@ install(DIRECTORY zoneminder DESTINATION /var/log DIRECTORY_PERMISSIONS OWNER_WR
install(DIRECTORY zoneminder DESTINATION /var/run DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder DESTINATION /var/cache DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY zoneminder-upload DESTINATION /var/spool DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY events images temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
install(DIRECTORY events temp DESTINATION /var/lib/zoneminder DIRECTORY_PERMISSIONS OWNER_WRITE OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)

# Install the Apache zoneminder files
install(FILES zm-httpd.conf DESTINATION /usr/lib/systemd/system/zoneminder.service.d PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ)
Expand Down
1 change: 0 additions & 1 deletion distros/redhat/httpd/zoneminder.httpd.tmpfiles.in
Expand Up @@ -2,5 +2,4 @@ D @ZM_TMPDIR@ 0755 @WEB_USER@ @WEB_GROUP@
D @ZM_SOCKDIR@ 0755 @WEB_USER@ @WEB_GROUP@
D @ZM_CACHEDIR@ 0755 @WEB_USER@ @WEB_GROUP@
d @ZM_DIR_EVENTS@ 0755 @WEB_USER@ @WEB_GROUP@
D @ZM_DIR_IMAGES@ 0755 @WEB_USER@ @WEB_GROUP@

1 change: 0 additions & 1 deletion distros/redhat/nginx/zoneminder.nginx.tmpfiles.in
Expand Up @@ -2,5 +2,4 @@ D @ZM_TMPDIR@ 0755 nginx nginx
D @ZM_SOCKDIR@ 0755 nginx nginx
D @ZM_CACHEDIR@ 0755 nginx nginx
d @ZM_DIR_EVENTS@ 0755 nginx nginx
D @ZM_DIR_IMAGES@ 0755 nginx nginx

2 changes: 0 additions & 2 deletions distros/redhat/zoneminder.spec
Expand Up @@ -377,7 +377,6 @@ EOF
%{_tmpfilesdir}/zoneminder.httpd.tmpfiles.conf
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/events
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/images
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/sock
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/swap
%dir %attr(755,%{zmuid_final},%{zmgid_final}) %{_sharedstatedir}/zoneminder/temp
Expand All @@ -402,7 +401,6 @@ EOF
%{_tmpfilesdir}/zoneminder.nginx.tmpfiles.conf
%dir %attr(755,nginx,nginx) %{_sharedstatedir}/zoneminder
%dir %attr(755,nginx,nginx) %{_sharedstatedir}/zoneminder/events
%dir %attr(755,nginx,nginx) %{_sharedstatedir}/zoneminder/images
%dir %attr(755,nginx,nginx) %{_sharedstatedir}/zoneminder/sock
%dir %attr(755,nginx,nginx) %{_sharedstatedir}/zoneminder/swap
%dir %attr(755,nginx,nginx) %{_sharedstatedir}/zoneminder/temp
Expand Down
1 change: 0 additions & 1 deletion distros/ubuntu1204/rules
Expand Up @@ -27,7 +27,6 @@ override_dh_auto_configure:
-DZM_CGIDIR="/usr/lib/zoneminder/cgi-bin" \
-DZM_CACHEDIR="/var/cache/zoneminder/cache" \
-DZM_DIR_EVENTS="/var/cache/zoneminder/events" \
-DZM_DIR_IMAGES="/var/cache/zoneminder/images" \
-DZM_PATH_ZMS="/zm/cgi-bin/nph-zms"

override_dh_clean:
Expand Down
1 change: 0 additions & 1 deletion distros/ubuntu1504_cmake_split_packages/rules
Expand Up @@ -64,7 +64,6 @@ override_dh_auto_configure:
-DZM_CONFIG_SUBDIR="/etc/zm/conf.d" \
-DZM_CONFIG_DIR="/etc/zm" \
-DZM_DIR_EVENTS="/var/cache/zoneminder/events" \
-DZM_DIR_IMAGES="/var/cache/zoneminder/images" \
-DZM_PATH_ZMS="/zm/cgi-bin/nph-zms"

override_dh_auto_test:
Expand Down
1 change: 0 additions & 1 deletion distros/ubuntu1604/rules
Expand Up @@ -27,7 +27,6 @@ override_dh_auto_configure:
-DZM_CGIDIR="/usr/lib/zoneminder/cgi-bin" \
-DZM_CACHEDIR="/var/cache/zoneminder/cache" \
-DZM_DIR_EVENTS="/var/cache/zoneminder/events" \
-DZM_DIR_IMAGES="/var/cache/zoneminder/images" \
-DZM_PATH_ZMS="/zm/cgi-bin/nph-zms"

override_dh_clean:
Expand Down
1 change: 0 additions & 1 deletion docs/installationguide/dedicateddrive.rst
Expand Up @@ -31,7 +31,6 @@ Add the following content to the file and save your changes:
::

ZM_DIR_EVENTS=/full/path/to/the/events/folder
ZM_DIR_IMAGES=/full/path/to/the/images/folder

**Step 5:** Start ZoneMinder and inspect the ZoneMinder log files for errors.
::
Expand Down
2 changes: 0 additions & 2 deletions docs/userguide/options/options_paths.rst
Expand Up @@ -7,8 +7,6 @@ ZM_DIR_EVENTS - This is the path to the events directory where all the event ima

USE_DEEP_STORAGE - Traditionally ZoneMinder stores all events for a monitor in one directory for that monitor. This is simple and efficient except when you have very large amounts of events. Some filesystems are unable to store more than 32k files in one directory and even without this limitation, large numbers of files in a directory can slow creation and deletion of files. This option allows you to select an alternate method of storing events by year/month/day/hour/min/second which has the effect of separating events out into more directories, resulting in less per directory, and also making it easier to manually navigate to any events that may have happened at a particular time or date.

DIR_IMAGES - ZoneMinder generates a myriad of images, mostly of which are associated with events. For those that aren't this is where they go. CAUTION: The directory you specify here cannot be outside the web root. This is a common mistake. Most users should never change this value. If you intend to save images to a second disk or network share, then you should mount the drive or share directly to the ZoneMinder images folder or follow the instructions in the ZoneMinder Wiki titled Using a dedicated Hard Drive.

DIR_SOUNDS - ZoneMinder can optionally play a sound file when an alarm is detected. This indicates where to look for this file. CAUTION: The directory you specify here cannot be outside the web root. Most users should never change this value.

PATH_ZMS - The ZoneMinder streaming server is required to send streamed images to your browser. It will be installed into the cgi-bin path given at configuration time. This option determines what the web path to the server is rather than the local path on your machine. Ordinarily the streaming server runs in parser-header mode however if you experience problems with streaming you can change this to non-parsed-header (nph) mode by changing 'zms' to 'nph-zms'.
Expand Down
4 changes: 2 additions & 2 deletions scripts/zmaudit.pl.in
Expand Up @@ -48,7 +48,6 @@ use Time::HiRes qw/gettimeofday/;
use Getopt::Long;
use autouse 'Pod::Usage'=>qw(pod2usage);

use constant IMAGE_PATH => $Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_IMAGES};
use constant EVENT_PATH => ($Config{ZM_DIR_EVENTS}=~m|/|)
? $Config{ZM_DIR_EVENTS}
: ($Config{ZM_PATH_WEB}.'/'.$Config{ZM_DIR_EVENTS})
Expand Down Expand Up @@ -144,7 +143,8 @@ require ZoneMinder::Event;

my $max_image_age = 6/24; # 6 hours
my $max_swap_age = 24/24; # 24 hours
my $image_path = IMAGE_PATH;
# images now live under the event path
my $image_path = EVENT_PATH;

my $loop = 1;
my $cleaned = 0;
Expand Down
2 changes: 0 additions & 2 deletions src/zm_config.cpp
Expand Up @@ -176,8 +176,6 @@ void process_configfile( char* configFile) {
staticConfig.SERVER_ID = atoi(val_ptr);
else if ( strcasecmp( name_ptr, "ZM_DIR_EVENTS" ) == 0 )
staticConfig.DIR_EVENTS = std::string(val_ptr);
else if ( strcasecmp( name_ptr, "ZM_DIR_IMAGES" ) == 0 )
staticConfig.DIR_IMAGES = std::string(val_ptr);
else if ( strcasecmp( name_ptr, "ZM_DIR_SOUNDS" ) == 0 )
staticConfig.DIR_SOUNDS = std::string(val_ptr);
else if ( strcasecmp( name_ptr, "ZM_DIR_EXPORTS" ) == 0 )
Expand Down
1 change: 0 additions & 1 deletion src/zm_config.h.in
Expand Up @@ -76,7 +76,6 @@ struct StaticConfig {
std::string SERVER_NAME;
unsigned int SERVER_ID;
std::string DIR_EVENTS;
std::string DIR_IMAGES;
std::string DIR_SOUNDS;
std::string DIR_EXPORTS;
std::string PATH_ZMS;
Expand Down
31 changes: 0 additions & 31 deletions web/ajax/zone.php
Expand Up @@ -9,37 +9,6 @@
ajaxError( 'No zone id(s) supplied' );
}

if ( canView( 'Monitors' ) )
{
switch ( $_REQUEST['action'] )
{
case "zoneImage" :
{
$wd = getcwd();
chdir( ZM_DIR_IMAGES );
$hiColor = '0x00ff00';

$command = getZmuCommand( " -m ".$_REQUEST['mid']." -z" );
if ( !isset($_REQUEST['zid']) )
$_REQUEST['zid'] = 0;
$command .= "'".$_REQUEST['zid'].' '.$hiColor.' '.$_REQUEST['coords']."'";
$status = exec( escapeshellcmd($command) );
chdir( $wd );

$monitor = dbFetchOne( 'SELECT * FROM Monitors WHERE Id = ?', NULL, array($_REQUEST['mid']) );
$points = coordsToPoints( $_REQUEST['coords'] );

ajaxResponse( array(
'zoneImage' => ZM_DIR_IMAGES.'/Zones'.$monitor['Id'].'.jpg?'.time(),
'selfIntersecting' => isSelfIntersecting( $points ),
'area' => getPolyArea( $points )
) );

break;
}
}
}

ajaxError( 'Unrecognised action or insufficient permissions' );

?>
6 changes: 2 additions & 4 deletions web/api/app/Controller/Component/ImageComponent.php
Expand Up @@ -7,12 +7,10 @@ public function getImageSrc( $event, $frame, $scale, $config ) {

$captImage = sprintf( "%0".$config['ZM_EVENT_IMAGE_DIGITS']."d-capture.jpg", $frame['Frame']['FrameId'] );
$captPath = $eventPath.'/'.$captImage;
$thumbCaptPath = $config['ZM_DIR_IMAGES'].'/'.$event['Event']['Id'].'-'.$captImage;

$analImage = sprintf( "%0".$config['ZM_EVENT_IMAGE_DIGITS']."d-analyse.jpg", $frame['Frame']['FrameId'] );
$analPath = $eventPath.'/'.$analImage;
$analFile = $config['ZM_DIR_EVENTS']."/".$analPath;
$thumbAnalPath = $config['ZM_DIR_IMAGES'].'/'.$event['Event']['Id'].'-'.$analImage;

$alarmFrame = $frame['Frame']['Type']=='Alarm';

Expand All @@ -31,8 +29,8 @@ public function getImageSrc( $event, $frame, $scale, $config ) {
$fraction = sprintf( "%.3f", $scale/100 );
$scale = (int)round( $scale );

$thumbCaptPath = preg_replace( "/\.jpg$/", "-$scale.jpg", $thumbCaptPath );
$thumbAnalPath = preg_replace( "/\.jpg$/", "-$scale.jpg", $thumbAnalPath );
$thumbCaptPath = preg_replace( "/\.jpg$/", "-$scale.jpg", $captPath );
$thumbAnalPath = preg_replace( "/\.jpg$/", "-$scale.jpg", $analPath );

if ( $isAnalImage )
{
Expand Down
1 change: 0 additions & 1 deletion web/api/app/Controller/EventsController.php
Expand Up @@ -318,7 +318,6 @@ public function createThumbnail($id = null) {
'ZM_WEB_LIST_THUMB_WIDTH',
'ZM_WEB_LIST_THUMB_HEIGHT',
'ZM_EVENT_IMAGE_DIGITS',
'ZM_DIR_IMAGES',
$thumbs,
'ZM_DIR_EVENTS'
)
Expand Down
29 changes: 0 additions & 29 deletions web/api/app/Controller/ZonesController.php
Expand Up @@ -137,33 +137,4 @@ public function delete($id = null) {
return $this->flash(__('The zone could not be deleted. Please, try again.'), array('action' => 'index'));
}
}

public function createZoneImage($id = null) {
$this->loadModel('Monitor');
$this->Monitor->id = $id;
if ( !$this->Monitor->exists() ) {
throw new NotFoundException(__('Invalid zone'));
}

$this->loadModel('Config');
$zm_dir_images = $this->Config->find('list', array(
'conditions' => array('Name' => 'ZM_DIR_IMAGES'),
'fields' => array('Name', 'Value')
));

$zm_dir_images = $zm_dir_images['ZM_DIR_IMAGES'];
$zm_path_web = Configure::read('ZM_PATH_WEB');
$zm_path_bin = Configure::read('ZM_PATH_BIN');
$images_path = "$zm_path_web/$zm_dir_images";

chdir($images_path);

$command = escapeshellcmd("$zm_path_bin/zmu -z -m $id");
system($command, $status);

$this->set(array(
'status' => $status,
'_serialize' => array('status')
));
}
} // end class
4 changes: 2 additions & 2 deletions web/index.php
Expand Up @@ -164,8 +164,8 @@
CORSHeaders();

// Check for valid content dirs
if ( !is_writable(ZM_DIR_EVENTS) || !is_writable(ZM_DIR_IMAGES) ) {
Warning("Cannot write to content dirs('".ZM_DIR_EVENTS."','".ZM_DIR_IMAGES."'). Check that these exist and are owned by the web account user");
if ( !is_writable(ZM_DIR_EVENTS) ) {
Warning("Cannot write to event folder ".ZM_DIR_EVENTS.". Check that it exists and is owned by the web account user.");
}

# Globals
Expand Down
4 changes: 0 additions & 4 deletions web/lang/ro_ro.php
Expand Up @@ -882,10 +882,6 @@ function zmVlang( $langVarArray, $count )
'Prompt' => "Directorul în care sunt stocate evenimentele",
'Help' => "Acesta este subdirectorul în care sunt salvate imaginile generate de evenimente şi alte fişiere. Implicit este un subdirector al directorului rădăcina zoneminder; dacă spaţiul nu vă permite puteţi să stocaţi imaginile pe altă partiţie, caz în care ar trebui să faceţi un link la subdirectorul implicit."
),
'DIR_IMAGES' => array(
'Prompt' => "Directorul în care sunt stocate imaginile",
'Help' => "ZoneMinder generează multe imagini, majoritate asociate cu evenimente. În acest director vor fi stocate imaginile neasociate evenimentelor."
),
'DIR_SOUNDS' => array(
'Prompt' => "Directorul cu sunetele care pot fi folosite de ZoneMinder",
'Help' => "ZoneMinder poate rula un sunet atunci când este detectată o alarmă. Acesta este directorul în care este stocat sunetul care va fi rulat."
Expand Down

0 comments on commit 3258d8e

Please sign in to comment.