Repository navigation
Clear the permission cache after adding Recent Topics permissions - #205
Merged
Merged
Conversation
rt_perms::add_permissions() adds its options, role data and group grants with raw INSERTs, which skip the acl_clear_prefetch() the migrator's permission tools run. phpBB only rebuilds a user's cached user_permissions when it is empty, so existing members kept a set without u_rt_view and saw no Recent Topics after the extension was enabled, until something else happened to clear the cache. Clear it at the end of add_permissions(), the same way core's remove_orphaned_roles migration does (no $auth is injected into a migration). Closes #194 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Closes #194.
Problem
rt_perms::add_permissions()adds theu_rt_*options, theROLE_USER_FULLrole data and the group grants with rawINSERTs. Unlike the migrator's permission tools, it never callsacl_clear_prefetch(). phpBB only rebuilds a user's cacheduser_permissionswhen that column is empty, so existing members kept a cached set withoutu_rt_view. After the extension was enabled, they saw no Recent Topics until something else happened to clear the cache.Fix
At the end of
add_permissions(), clear the cache the way core'sv33x\remove_orphaned_rolesmigration does:A migration has no injected
$auth, andacl_clear_prefetch()works through globals.Verification
add_permissions()builds its ownauth, so a mock-based unit test can't observe the clear. Instead I ran the real migration step against the local board's database with a boot script: give a member a cached permission set, runadd_permissions()from a given file, then measureuser_permissions.develop33After the clear, phpBB rebuilds the member's permissions with
u_rt_view = 1.The unit suite still passes (44 tests, 0 failures); the functional tests run in CI.
Note on existing installs: this fixes fresh enables. Boards that already enabled 3.0.11 have their cache cleared by any later cache purge or permission change, so they don't need a separate migration.
No changelog entry or version bump, per this repo's convention.
🤖 Generated with Claude Code