Summary
rt_perms::add_permissions() (migrations/basics/rt_perms.php) adds the extension's permissions with raw INSERTs into acl_options, acl_roles_data, and acl_groups. phpBB caches each user's resolved permissions in users.user_permissions and only rebuilds that column when it's empty. The migrator's permission tools (permission.add, permission.role_add, permission.permission_set) call acl_clear_prefetch() after making grants specifically to empty that column so new grants take effect immediately. The raw inserts here skip that step, and enabling an extension does not purge the cache on its own.
Result: every user who already has a cached permission set keeps it without u_rt_view — the Recent Topics block and standalone pages render nothing for them until an unrelated cache purge or permission change happens to clear the prefetch.
Steps to reproduce
- On a clean board with existing members (cached
user_permissions already populated), enable the Recent Topics extension.
- Log in as a normal member with the
REGISTERED group grant in place.
u_rt_view resolves to 0 for that member and the Recent Topics block/pages show nothing, even though the permission was just granted to their group.
Location
avathar/recenttopics/migrations/basics/rt_perms.php, add_permissions() — after the acl_options / acl_roles_data / acl_groups inserts, nothing clears the prefetch cache.
Fix
rt_perms extends the base \phpbb\db\migration\migration, which only exposes $config, $db, $db_tools, $phpbb_root_path, $php_ext, $table_prefix — there's no injected $this->auth, so a $this->auth->acl_clear_prefetch() call would fatal here.
phpBB core hits the same situation in its own migrations and resolves it by instantiating auth directly (its acl_clear_prefetch() relies on globals, not constructor DI) — see phpbb/db/migration/data/v33x/remove_orphaned_roles.php:
$auth = new \phpbb\auth\auth();
$auth->acl_clear_prefetch();
Add the same two lines at the end of add_permissions() in rt_perms.php.
Summary
rt_perms::add_permissions()(migrations/basics/rt_perms.php) adds the extension's permissions with rawINSERTs intoacl_options,acl_roles_data, andacl_groups. phpBB caches each user's resolved permissions inusers.user_permissionsand only rebuilds that column when it's empty. The migrator's permission tools (permission.add,permission.role_add,permission.permission_set) callacl_clear_prefetch()after making grants specifically to empty that column so new grants take effect immediately. The raw inserts here skip that step, and enabling an extension does not purge the cache on its own.Result: every user who already has a cached permission set keeps it without
u_rt_view— the Recent Topics block and standalone pages render nothing for them until an unrelated cache purge or permission change happens to clear the prefetch.Steps to reproduce
user_permissionsalready populated), enable the Recent Topics extension.REGISTEREDgroup grant in place.u_rt_viewresolves to0for that member and the Recent Topics block/pages show nothing, even though the permission was just granted to their group.Location
avathar/recenttopics/migrations/basics/rt_perms.php,add_permissions()— after theacl_options/acl_roles_data/acl_groupsinserts, nothing clears the prefetch cache.Fix
rt_permsextends the base\phpbb\db\migration\migration, which only exposes$config,$db,$db_tools,$phpbb_root_path,$php_ext,$table_prefix— there's no injected$this->auth, so a$this->auth->acl_clear_prefetch()call would fatal here.phpBB core hits the same situation in its own migrations and resolves it by instantiating
authdirectly (itsacl_clear_prefetch()relies on globals, not constructor DI) — seephpbb/db/migration/data/v33x/remove_orphaned_roles.php:Add the same two lines at the end of
add_permissions()inrt_perms.php.