Repository navigation
[3.0] Lists tied moderation log entries in a defined order - #9726
Merged
jdarwood007 merged 1 commit intoOct 4, 2026
Merged
Conversation
Every column the moderation and administration logs sort by can tie, the time column included for entries logged in the same second, and the query left the order of tied entries to the database. The engines disagree: MySQL listed them oldest first in the default newest-first view, and PostgreSQL's order changes when a row is rewritten. Ties now fall back to the order the entries were logged, reversed along with the column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The moderation log and the administration log sort by one column and leave the order of tied entries to the database. Every one of their columns can tie: time for entries logged in the same second (any request that logs more than one entry produces those), and action, moderator, position and IP for most of the log.
The two engines disagree about ties:
I found this through the template snapshot suite (#9712). On MySQL, the admin log page listed a different set of entries from one run to the next, because each run logs a category and several boards within the same second.
The fix is in
Logs::list_getModLogEntries(), which both lists use (the log page andReportedContent). Tied entries fall back tolm.id_action, the order they were logged in. The tiebreaker takes its direction from the column: when the column sorts descending,id_actiondoes too. So reversing a column gives the exact mirror of the list. Putting it in the query function, not in the ten column definitions, also covers columns a mod adds throughintegrate_hooks.Tests
tests/Integration/ModLogTest.phplogs two identical entries at the same time and lists them under each sort the two lists offer.Without the fix, 4 of the 8 cases fail on each engine, and they are different cases on each:
With the fix, all 8 pass on both engines, three runs each. The full unit and integration suite also passes on both.
Issues References (Fixes|Related|Closes)
Related: #9712, #9721 and #9722 fix the same kind of problem, a sort with no tiebreaker, in other places.
🤖 Generated with Claude Code