Trims watchdog to the configured row limit, oldest first.
The pivot-then-delete shape is copied from DblogHooks::cron() rather than
improved on, and core's own comment says why: counting the most recent N rows
survives an AUTOINCREMENT sequence that does not start at 1 and rows deleted
out from under it, which an arithmetic wid < max - limit does not.
Under the limit it issues ONE statement, finds no pivot, and writes nothing.
Trims watchdog to the configured row limit, oldest first.
The pivot-then-delete shape is copied from DblogHooks::cron() rather than improved on, and core's own comment says why: counting the most recent N rows survives an AUTOINCREMENT sequence that does not start at 1 and rows deleted out from under it, which an arithmetic
wid < max - limitdoes not.Under the limit it issues ONE statement, finds no pivot, and writes nothing.