Skip to content

Modules::flagsCli only set on (re)install / refresh — existing installs don't discover CLI modules until refreshed (508ef78b) #2241

@adrianbj

Description

@adrianbj

Short description of the issue

Commit 508ef78b introduced the new flagsCli bit that drives CLI module discovery via findByFlag(Modules::flagsCli). The bit is populated only by ModulesFlags::setFlags(), which runs during install or refresh. Installs with already-installed modules that declare 'cli' => ... in their info will not be discovered until the user runs a Modules refresh.

Expected behavior

After upgrading to a version that supports CLI modules, php index.php list (or equivalent) discovers all installed CLI modules without requiring a manual refresh.

Actual behavior

In wire/core/Modules/ModulesFlags.php:

  • setFlags() calculates flagsCli from $info['cli'] only during install/refresh.
  • Existing modules in the DB still have their old flags row, with flagsCli unset.
  • findByFlag(flagsCli) returns nothing, so getCliModules() falls back to module-name lookup. Explicit php index.php SomeModule calls work; the help listing silently omits pre-existing CLI modules.

Optional: Suggestion for a possible fix

Either:

  1. Auto-refresh flags on first CLI invocation (cheap, defensive).
  2. Run a one-time flag backfill at module-system init when flagsCli is missing from the flag schema.
  3. Document the need to run "Modules → Refresh" after upgrade in the release notes.

Setup/Environment

  • ProcessWire version: dev @ 15c749ed
  • File: wire/core/Modules/ModulesFlags.php
  • Introduced in commit 508ef78b

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions