1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-10 00:42:41 +01:00

Log Herald rules having disabled Herald rules as condition via phlog()

Summary:
Do not silently fail when a Herald rule refers in its conditions to a disabled rule.
Allow Phorge administrators to get aware by creating an entry in the error log via phlog() instead of crossing fingers that someone may from time to time get the idea to open and read Herald transcripts.

This is similar to T15885 / D25735.

Refs T15869

Test Plan:
1. Phorge at `0873b36569bfcf502a092870d7d5f4d088ed9003`
2. Set up a Herald rule and disable it
3. Set up a second Herald rule with several conditions, the first condition being "Another Herald rule matches" on the disabled first Herald rule
4. Go to http://phorge.localhost/herald/test/ to apply the Herald rule on a corresponding object
5. See an exception in the resulting transcript at http://phorge.localhost/herald/transcript/123456/
6. After applying this patch, also find that exception in the error log

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T15869

Differential Revision: https://we.phorge.it/D25736
This commit is contained in:
Andre Klapper 2024-07-21 19:20:29 +02:00
parent f6302c7ee3
commit 71615f4b99

View file

@ -593,6 +593,10 @@ final class HeraldEngine extends Phobject {
$this->popProfilerRule($rule); $this->popProfilerRule($rule);
if ($caught) { if ($caught) {
phlog(pht('An exception occurred executing Herald rule %s: "%s" Review '.
'the Herald transcripts and correct or disable the problematic rule.',
$rule->getMonogram(),
$caught->getMessage()));
throw $caught; throw $caught;
} }