Skip to content

Existing users get no Recent Topics after enabling the extension (u_rt_view not applied — stale permission cache) #194

Description

@avandenberghe

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

  1. On a clean board with existing members (cached user_permissions already populated), enable the Recent Topics extension.
  2. Log in as a normal member with the REGISTERED group grant in place.
  3. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugv3.0Version 3.0.x - maintenance releases

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions