TABLE
TABLE = 'strata_health'
The table findings live in.
The ledger a site runs on.
Findings outlive the request that noticed them, so a verify pass on cron leaves something for the health dashboard to show and something the repair ladder can escalate from. This is one of the two tables an uninstall exports before dropping, because nothing in the bucket can reproduce it: the bucket records what the site looks like, not what went wrong reaching it.
A row is inserted once per code and scope and given a fresh timestamp when the same symptom is seen again, so a check that fires every cron run produces one open row rather than one row per run. What the dashboard sorts by is how many scopes a code covers, which is the difference between one broken frame and a broken bucket.
purge(int $olderThan) : int
Drops findings recorded before a point in time.
Only resolved rows are dropped. An open finding is the reason someone is looking at the dashboard, and age is not evidence that it stopped being true.
| int | $olderThan | Unix timestamp; findings recorded strictly before this are dropped. |
How many findings were dropped.
rungFor(string $code) : string
The rung a code currently sits at.
The rung is stored per row but is a property of the CODE, so the answer is the highest rung any row for that code carries. A code with nothing recorded sits at the bottom of the ladder.
| string | $code | The finding code. |
A rung name from RepairLadder::RUNGS.
setRung(string $code, string $rung) : void
Moves a code to a rung.
| string | $code | The finding code. |
| string | $rung | A rung name from RepairLadder::RUNGS. |
When the rung is not one the ladder knows. Storing a typo would park the code where RepairLadder::isAutomatic() refuses it forever.
summary() : list<array{code: string, severity: int, rung: string, scopes: int, newest: int}>
How many times each open code has been seen, worst first.
What the health dashboard lists. Grouped in the database rather than by loading every row, since a site that has been broken for a week can hold a lot of them.
One row per open code.
startingRung(\Drupal\strata\Health\Finding $finding) : string
The rung a finding lands on.
A code that has already been escalated stays where it is. Otherwise the severity decides, which is what puts a critical finding straight at quarantine instead of walking it up the ladder one cron run at a time while the site cannot restore.
| \Drupal\strata\Health\Finding | $finding | The finding being recorded. |
The rung name.