Skip to content

Commit a50a27c

Browse files
fix: canonicalise Monitors.ObjectDetection to lowercase
The column's values are all lowercase - 'none', 'quadra', 'uvicorn', 'openvino', 'mx_accl' - and the column default is 'none', but the monitor edit UI offered the off setting keyed as 'None'. Since 1.37.69 the column is a plain VARCHAR rather than an enum, so that spelling was stored verbatim and zmc logged "Unsupported value for ObjectDetection: None" for every affected monitor on load. The console's javascript compared against 'none' and so listed those monitors as actively object detecting, and monitor.js's ObjectDetection_onChange fell through to its unknown-value branch, leaving the model and threshold fields showing for a monitor with detection off. Fix the stored value rather than teaching every reader to accept both spellings: write 'none' from the UI, the Monitor.php defaults, the console ajax fallback and Monitor.pm, and add zm_update-1.39.19.sql to lower existing rows. The UPDATE is unconditional because the default collation is case-insensitive, so a `WHERE ObjectDetection != LOWER(ObjectDetection)` guard would never match; it is idempotent as written. Also correct the console's fps column, which tested ObjectDetection against 'None' where every other test used 'none', and treat a NULL column as 'none' in Monitor::Load instead of constructing a std::string from a null pointer. Bump version.txt and the redhat spec Version to 1.39.19. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GuPNKrTGdfFT4t6G2BJbug
1 parent e845878 commit a50a27c

9 files changed

Lines changed: 25 additions & 8 deletions

File tree

db/zm_update-1.39.19.sql

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--
2+
-- Canonicalise Monitors.ObjectDetection to lowercase.
3+
--
4+
-- The column's values are all lowercase ('none', 'quadra', 'uvicorn',
5+
-- 'openvino', ...) but the monitor edit UI offered the off setting as 'None'
6+
-- with a capital N, and the column has been a plain VARCHAR since 1.37.69, so
7+
-- that spelling was stored verbatim. zmc only recognised 'none' and logged
8+
-- "Unsupported value for ObjectDetection: None" for every such monitor on
9+
-- load, the console's javascript reported it as actively object detecting,
10+
-- and the monitor edit page left the model/threshold fields showing.
11+
--
12+
-- Unconditional LOWER() rather than a WHERE clause: the default collation is
13+
-- case-insensitive, so `WHERE ObjectDetection != LOWER(ObjectDetection)`
14+
-- would never match. This is idempotent as written.
15+
--
16+
17+
UPDATE `Monitors` SET `ObjectDetection` = LOWER(`ObjectDetection`);

distros/redhat/zoneminder.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
%global zmtargetdistro %{?rhel:el%{rhel}}%{!?rhel:fc%{fedora}}
2222

2323
Name: zoneminder
24-
Version: 1.39.18
24+
Version: 1.39.19
2525
Release: 1%{?dist}
2626
Summary: A camera monitoring and analysis tool
2727
Group: System Environment/Daemons

scripts/ZoneMinder/lib/ZoneMinder/Monitor.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ $fields{model} = undef;
195195
Analysing => q`'Always'`,
196196
AnalysisSource => q`'Primary'`,
197197
AnalysisImage => q`'FullColour'`,
198-
ObjectDetection => q`'None'`,
198+
ObjectDetection => q`'none'`,
199199
ObjectDetectionModel => q`''`,
200200
ObjectDetectionObjectThreshold => 0.4,
201201
ObjectDetectionNMSThreshold => 0.25,

src/zm_monitor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ void Monitor::Load(MYSQL_ROW dbrow, bool load_zones = true, Purpose p = QUERY) {
417417
col++;
418418
analysis_image_opacity = dbrow[col] ? atoi(dbrow[col]) : 128;
419419
col++;
420-
std::string od = dbrow[col]; col++;
420+
std::string od = dbrow[col] ? dbrow[col] : "none"; col++;
421421
if (od == "none") {
422422
objectdetection = OBJECT_DETECTION_NONE;
423423
} else if (od == "mx_accl") {

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.39.18
1+
1.39.19

web/ajax/console.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ function queryRequest() {
420420
$row['CaptureBandwidth'] = '';
421421
}
422422
$row['Analysing'] = isset($monitor['Analysing']) ? $monitor['Analysing'] : 'None';
423-
$row['ObjectDetection'] = isset($monitor['ObjectDetection']) ? $monitor['ObjectDetection'] : 'None';
423+
$row['ObjectDetection'] = isset($monitor['ObjectDetection']) ? $monitor['ObjectDetection'] : 'none';
424424
$row['Recording'] = isset($monitor['Recording']) ? $monitor['Recording'] : 'None';
425425
// console.js treats this as both an enable flag AND the text to display:
426426
// if (row.ONVIF_Event_Listener) html += "Use ONVIF '" + row.ONVIF_Event_Listener + "'"

web/includes/Monitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public static function getStreamChannelOptions() {
244244
'AnalysisSource' => 'Primary',
245245
'AnalysisImage' => 'FullColour',
246246
'AnalysisImageOpacity' => array('type'=>'integer','default'=>128),
247-
'ObjectDetection' => 'None',
247+
'ObjectDetection' => 'none',
248248
'ObjectDetectionModel' => '',
249249
'ObjectDetectionObjectThreshold' => '0.4',
250250
'ObjectDetectionNMSThreshold' => '0.25',

web/skins/classic/views/js/console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ function processRows(rows) {
284284
if (row.CaptureFPS) {
285285
fps_string = row.CaptureFPS;
286286
}
287-
if (row.AnalysisFPS && (row.Analysing != 'None' || row.ObjectDetection != 'None')) {
287+
if (row.AnalysisFPS && (row.Analysing != 'None' || row.ObjectDetection != 'none')) {
288288
fps_string += '/' + row.AnalysisFPS;
289289
}
290290
if (fps_string) fps_string += ' fps';

web/skins/classic/views/monitor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ class="nav-link<?php echo ($tab == $name ? ' active' : '') . ' ' . (($name == 'z
10991099
<li class="ObjectDetection">
11001100
<label><?php echo translate('Object Detection')?></label>
11011101
<?php
1102-
$od_options = ['None'=>'None', 'uvicorn'=>'Remote API'];
1102+
$od_options = ['none'=>'None', 'uvicorn'=>'Remote API'];
11031103
if (defined('HAVE_UNTETHER'))
11041104
$od_options['speedai'] = 'Untether SpeedAI';
11051105
if (defined('ZM_HAVE_QUADRA') and ZM_HAVE_QUADRA)

0 commit comments

Comments
 (0)