A small zmfilter.pl fix

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

A small zmfilter.pl fix

Post by timcraig »

I'm running a Zoneminder 2.22.3 installation and I was having problems running background filters.

If I had a filter with "Name" set with operator "matches", the filter would not work when running in the background. The zmfilter.log file would list an error like:

12/09/07 21:09:02.642208 zmfilter[4676].ERR [Can't execute filter 'select E.Id,E.MonitorId,M.Name as MonitorName,M.DefaultRate,M.DefaultScale,E.Name,E.Cause,E.Notes,E.StartTime,unix_timestamp(E.StartTime) as Time,E.Length,E.Frames,E.AlarmFrames,E.TotScore,E.AvgScore,E.MaxScore,E.Archived,E.Videoed,E.Uploaded,E.Emailed,E.Messaged,E.Executed from Events as E inner join Monitors as M on M.Id = E.MonitorId where not isnull(E.EndTime) and ( E.Archived = 0 and E.Name regexp Event- and E.StartTime <2007>"Does Not Match" case.
On line 378:
$filter_sql .= " not regexp $value";
needs to be changed to
$filter_sql .= " not regexp '$value'";

With those changes, my filters began to work after restarting ZM.
User avatar
zoneminder
Site Admin
Posts: 5215
Joined: Wed Jul 09, 2003 2:07 pm
Location: Bristol, UK
Contact:

Post by zoneminder »

Thanks for this. Sorry, I forgot to comment at the time when you posted.
Phil
timcraig
Posts: 195
Joined: Mon Dec 10, 2007 5:53 pm
Location: San Jose, CA

Post by timcraig »

No problem. Thank you for making zoneminder. I really love the software.


Another part in the code to fix is on line 374

$filter_sql .= " regexp $value";

needs to be changed to

$filter_sql .= " regexp '$value'";
Post Reply