Files
zoneminder/db/zm_update-1.39.37.sql
T
Isaac ConnorandClaude Opus 5 af0d6ddc32 refactor: remove RTSPDescribe, which lost its reader with the rtsp client
RTSPDescribe chose whether to take the media url from the DESCRIBE
response rather than the configured path. That was a quirk of
ZoneMinder's own rtsp implementation; ffmpeg decides it itself. Removing
that client left the setting with nothing behind it -- the monitor form
still drew the checkbox and the save path still wrote the column, but no
code read it, so the only thing it could do was mislead whoever ticked
it.

Drops the form row and the Remote-only block that existed to hold it,
the javascript that showed and hid it as the protocol changed, the field
in the php and perl monitor models, the default in the save action, the
column from the schema, and the label and help text from all the
language files carrying them.

The 1.39.37 migration drops the column behind an information_schema
guard scoped to DATABASE(), so the file stays re-runnable.

Verified by building a pre-upgrade database from upstream/master's own
schema and applying the migration: the column goes, and Monitors matches a fresh install of this
branch column for column. Migration applied three times with no error.
php -l clean on the four edited files and all 28 language files, perl -c
clean, build clean, 154 test cases pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Y6FieTwEXuLhhR4e2yiax
2026-10-10 09:32:17 -04:00

52 lines
2.3 KiB
SQL

--
-- This updates a 1.39.36 database to 1.39.37
--
-- Move Remote/rtsp monitors to Ffmpeg.
--
-- The hand-written rtsp client behind Remote/rtsp is removed in this
-- release. Every camera it reached, ffmpeg reaches, so the monitors are
-- converted rather than left to fail. Remote/http is untouched.
--
--
-- Remote/rtsp becomes Ffmpeg with the equivalent url.
--
-- Credentials are deliberately NOT written into the url. FfmpegCamera merges
-- User and Pass into the path itself, percent-encoding them through the Url
-- class, and only when the path does not already carry credentials. Leaving
-- them in their own columns therefore keeps passwords containing @ : / or #
-- working, which string-building them here would break. A Host that already
-- embeds user:pass@ also still works: the path then carries credentials and
-- the runtime merge correctly leaves it alone.
--
UPDATE `Monitors`
SET `Type` = 'Ffmpeg',
`Path` = CONCAT('rtsp://', `Host`,
IF(`Port` IS NULL OR `Port` = '', '', CONCAT(':', `Port`)),
IF(`Path` IS NULL OR `Path` = '', '/',
IF(LEFT(`Path`, 1) = '/', `Path`, CONCAT('/', `Path`))))
WHERE `Type` = 'Remote' AND `Protocol` = 'rtsp';
--
-- Monitors.RTSPDescribe goes with the rtsp client that was its only reader.
--
-- It chose whether to take the media url from the DESCRIBE response rather
-- than the configured path, which was a quirk of ZoneMinder's own rtsp
-- implementation. Ffmpeg handles that itself, so with that client removed the
-- setting had nothing behind it: the web ui still drew the checkbox and still
-- saved the value, but nothing read the column.
--
-- Guarded so the file stays re-runnable: DROP COLUMN is the one statement
-- here that fails rather than no-ops the second time. Scoped to DATABASE()
-- so a same-named column in another schema cannot satisfy the check.
--
set @exist := (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = DATABASE()
AND table_name = 'Monitors' AND column_name = 'RTSPDescribe');
set @sqlstmt := if(@exist > 0,
'ALTER TABLE `Monitors` DROP COLUMN `RTSPDescribe`',
"SELECT 'Monitors.RTSPDescribe has already been dropped'");
PREPARE stmt FROM @sqlstmt;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;