ZoneMinder::Config has loaded ZoneMinder::ConfigData with a run-time
require since 24a75775d (refs #5547). ConfigData set itself up in an
INIT block, and Perl skips INIT blocks of code compiled after the INIT
phase, printing "Too late to run INIT block at .../ConfigData.pm line
72." zmupdate.pl reaches that through syncConfigFlags() at the end of
every upgrade, and through saveConfigToDB() with -f.
The options were still set up, because loadConfigData() calls
initialiseConfig() itself after the require, so only the warning goes.
ConfigData now calls initialiseConfig() at the end of the module, which
runs whether it is loaded with use or require. initialiseConfig() returns
early on a second call, so loadConfigData()'s call does nothing new.
config_lazy_load.t checks that loading ConfigData at run time prints
no INIT warning.
fixes#8503
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* fix: record an event under a time-based id when its insert keeps failing refs #7999
* fix: an event whose insert fails while zmc shuts down records under a fallback id too refs #7987
Event::Event stopped retrying the Events insert as soon as zm_terminate was
set, leaving the event with id 0, so its frames and video were written under
event 0. It now takes the same time-based fallback id it uses after three
failed attempts, so the recording is kept and zmrecover.pl can add it.
Monitor::openEvent never sees an id of 0 any more.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* feat: zmrecover gives an event recorded under a fallback id a normal id, and zmaudit keeps it refs #7999
When zmc cannot insert an event's row it records the event under a time-based
id far above the auto increment range. Recovering it as-is would leave that id
in the Events table and push auto increment past it.
ZoneMinder::Event::save_with_new_id() inserts the row without an Id, so it gets
the next auto increment id, then moves the event to match: the Medium or
Shallow directory, the Deep .<id> link or Shallow .<id> file, the
<id>-video.* file, the eid and file name in index.m3u8, DefaultVideo, the
recovered name, and any Frames, Stats, Event_Data, Events_Tags,
Snapshots_Events and Events_* summary rows zmc queued under the old id. If the
directory cannot be moved it removes the new row and keeps the old id, so a
later run can try again. zmrecover.pl saves every recovered event through it
when the id is in the fallback range.
zmaudit deleted the files of any event with no row once it was older than
ZM_AUDIT_MIN_AGE, which would throw away exactly the video the fallback id
exists to keep. It now warns and leaves those events for zmrecover.pl, and its
orphaned Frames, Stats and Event_Data cleanups stop below the fallback range.
The zmaudit and zmrecover tests that replace ZoneMinder::Event with a stub get
the two new names.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Jash <jashambaliya1@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>