Skip to content

Document the nine missing console commands, and give them stable anchors - #595

Open
karl-bullock wants to merge 2 commits into
flarum:mainfrom
karl-bullock:docs-console-command-reference
Open

karl-bullock wants to merge 2 commits into
flarum:mainfrom
karl-bullock:docs-console-command-reference

Conversation

@karl-bullock

Copy link
Copy Markdown
Member

console.md documents ten commands. Nine more are registered and were missing from it entirely, including two that exist specifically to help a 1.x forum finish moving to 2.0.

The commands

Command Why it matters to an admin
extension:enable (alias extension:disable) Toggling an extension from the CLI, which is often the way out when a bad extension has made the admin dashboard unreachable.
extension:bisect Finds which extension is causing a problem by progressively toggling them. Documented with a warning that it puts the forum into maintenance mode while it runs.
schema:dump Noted, and noted as a development tool rather than something to run on a live forum.
queue:pause / queue:resume Stopping workers taking new jobs without stopping the workers, which is what you want immediately before a deployment. Includes the connection:queue prefix and --all.
avatars:convert-to-webp Converts existing avatars to WebP after upgrading. See below.
avatars:backfill-variants Re-checks which @2x / @3x avatar files exist and corrects Flarum's record of them, which matters if avatar files were restored from a backup or moved between disks. Includes --chunk and --force.
announcements:refresh Fetches the admin dashboard announcements.
extensions:sync-abandoned Refreshes the abandoned-extension list behind the warning on an extension's card.

Options and behaviour are taken from the command classes rather than guessed. Both avatar commands note that they only touch avatars stored on the forum itself and skip ones hosted elsewhere as a URL, and avatars:convert-to-webp notes that it skips GIFs so animated avatars stay animated. announcements:refresh and extensions:sync-abandoned are both scheduled weekly by core (the latter with --notify), so they say so rather than implying you need to run them yourself, and announcements:refresh mentions that flarum_announcements.disabled turns the feature and the command off together.

An "After the Upgrade" section in update.md

2.0 saves newly uploaded avatars as WebP where 1.x saved PNG, and avatars:convert-to-webp exists to convert the ones already there. WebP was not mentioned anywhere in the admin documentation, and update.md went straight from "restart your PHP process" into Troubleshooting, so nobody upgrading would learn the command exists. It is explicitly optional, since pre-upgrade avatars keep working untouched.

Why the headings now carry explicit anchors

This started as a broken link of my own and turned out to be a property of the whole page.

Docusaurus derives a heading's id from its first text node, and a colon begins a new one, so every command heading on this page collapsed to a truncated anchor: cache:clear was #cache, schedule:run was #schedule, and schedule:list was #schedule-1. The numeric suffixes are positional, so they move as soon as a section is inserted above them, and adding nine commands made that considerably worse by introducing more colliding prefixes (avatars / avatars-1, extension / extension-1, queue / queue-1).

Each command heading now declares its own id, so #cache-clear and #avatars-convert-to-webp mean what they say and stop moving. The rendered heading text is unchanged, and I verified the generated ids and heading text in the build output.

This does change existing anchor URLs, which is the one judgement call in here: an old link to #cache or #migrate-1 will no longer resolve. I thought that was worth it, because those anchors are both ambiguous and positional today, and console.md is a reference page people deep-link into. Happy to drop this part and keep only the new commands if you would rather not move the existing anchors.

Verification

npx docusaurus build --locale en completes with no errors, and Docusaurus's broken-anchor check reports nothing for either page (it flagged both before this change, which is how I found the anchor problem). Every command name, option, default and description was read from its class in flarum/[email protected].

Two related notes, no action needed here: the flarum/realtime commands are deliberately left out, since #593 covers that extension's documentation as a whole. And a maintainer branch, im/avatar-webp-docs, already adds a WebP note to extend/update-2_0.md for extension developers; this PR touches the admin-facing pages only, so the two do not overlap.

console.md documented ten commands. Nine more are registered and were absent: extension:enable (and its extension:disable alias), extension:bisect, schema:dump, queue:pause, queue:resume, avatars:convert-to-webp, avatars:backfill-variants, announcements:refresh and extensions:sync-abandoned.

Options and behaviour come from the command classes, so queue:pause documents its connection:queue prefix and --all, avatars:backfill-variants documents --chunk and --force, and the two avatar commands note that they only touch avatars stored on the forum itself. announcements:refresh and extensions:sync-abandoned are both scheduled weekly by core, the latter with --notify, so they say that rather than implying you need to run them by hand. extension:bisect warns that it puts the forum into maintenance mode.

update.md gained a short "After the Upgrade" section. Flarum 2.0 saves new avatars as WebP where 1.x saved PNG, and avatars:convert-to-webp converts the ones already there, but nothing in the admin documentation mentioned WebP at all, so nobody upgrading would know the command exists.

The command headings also now carry explicit anchors. Docusaurus builds a heading id from the first text node only, and a colon starts a new one, so every command on this page collapsed to a truncated, order-dependent anchor: cache:clear was #cache, schedule:run was #schedule, and schedule:list was #schedule-1, which shifts as soon as a section is added above it. Adding the nine commands made that worse by introducing more colliding prefixes. Each heading now declares its own id, so #cache-clear and #avatars-convert-to-webp mean what they say and stay put. The visible heading text is unchanged.
Verified on a real Flarum 2.0.0-rc.8 instance that `php flarum list` does not include schema:dump. GenerateDumpCommand does call setName('schema:dump'), which is what I documented it from, but its registration is commented out in ConsoleServiceProvider with the note "Used internally to create DB dumps before major releases", so the command is unavailable to everybody.

The other eighteen commands on the page were confirmed present on that instance, with their documented options: migrate --isolated, avatars:backfill-variants --chunk (default 100) and --force, the queue argument and --all on queue:pause and queue:resume, -e/--execute on tinker, and extension:disable as an alias of extension:enable sharing its extension-id argument. schedule:list confirms both fetch commands run weekly at 0 0 * * 0, with --notify on extensions:sync-abandoned.
@karl-bullock

Copy link
Copy Markdown
Member Author

I stood up a Flarum 2.0.0-rc.8 instance and ran this page against it, rather than trusting my reading of the source. One correction, now pushed.

schema:dump is gone from the page. It does not exist on any install. GenerateDumpCommand does call setName('schema:dump'), which is what I originally documented it from, but its registration is commented out in ConsoleServiceProvider:

// Used internally to create DB dumps before major releases.
// \Flarum\Database\Console\GenerateDumpCommand::class

php flarum list on rc.8 confirms it is absent. My mistake, and a good argument for running the thing rather than reading it.

Everything else on the page checked out on that instance, which is the more useful half of the result:

  • All eighteen remaining commands are present in php flarum list.
  • migrate --isolated exists.
  • avatars:backfill-variants has --chunk with [default: "100"] and --force.
  • queue:pause and queue:resume both take the queue argument with the documented connection:queue prefix, and --all.
  • tinker has -e, --execute, and php flarum tinker -e "User::count()" returns => 1, matching the documented output shape.
  • extension:disable is confirmed an alias of extension:enable, sharing its extension-id argument and the description "Enable or disable an extension."
  • schedule:list shows 0 0 * * 0 for both extensions:sync-abandoned --notify and announcements:refresh, confirming the weekly claim and the --notify flag.
  • cache:clear, assets:publish and avatars:convert-to-webp all run cleanly, the last reporting "No avatars to convert." on a forum with none, as the page implies.

Incidentally, php -m on that instance lists pdo_pgsql, pgsql and pdo_sqlite alongside pdo_mysql, which is consistent with the driver note in #592.

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant