Skip to content

Install a missing storage driver from the manager or artisan - #5

Merged
elcreator merged 2 commits into
optional-driversfrom
install-drivers
Nov 16, 2026
Merged

elcreator merged 2 commits into
optional-driversfrom
install-drivers

Conversation

@elcreator

Copy link
Copy Markdown
Owner

Stacked on #4 (base optional-drivers). Once #4 merges, GitHub retargets this to main.

#4 made every storage driver except the local one an optional package. This PR lets you install a missing driver without writing the Composer commands yourself.

From the manager (administrators)

A missing driver in the "connect storage" picker now has an Install button. The button doesn't run Composer in the web request:

  • The page queues an amount.driver_install task through the core's SystemTaskService::createTaskFromStoreRequest(). The core's own checks run first: the system_tasks.manage_packages permission, the super-administrator gate, the exclusive lock shared with site updates and other installs, and the scheduler's health.
  • system:task-worker runs the task using the core's ConsoleInstallFlowService, the same flow the Extras module uses. That means package:installrequire (which checks the site still boots and rolls back if it doesn't), then package:discover, vendor:publish and migrate.
  • The page polls the task, shows progress, and reloads the driver list once the driver loads. Reopening the page picks up an install that is still running (bootstrap.driver_installs).
  • A request names a driver, never a package. The worker reads the packages from the driver again, so neither this page nor the core's generic task endpoint can use the task type to install anything else.
  • Managers who aren't administrators still see the command, and the API refuses them with 403.

From artisan

php artisan amount:drivers --install=s3,sftp,webdav

This runs package:installrequire once per missing package. package:installrequire rolls back only its own package, so this PR doesn't use the "record without running Composer" shortcut. It is now also the install hint everywhere, instead of the raw package:installrequire line. The README drops the three-command block from #4.

Also

  • Driver::missingPackages() asks Composer which packages are installed. A driver whose package is installed but still can't start (FTP without ext-ftp) gets a clear message instead of an install that would change nothing.
  • routes.php now imports ComputerController like every other controller. /computers answered 200 in the demo without the import, so this is only for consistency.
  • DESIGN hard rule 11, AGENTS.md and the README security section describe the above. The 11 new strings are translated into all 21 locales.

Tests

  • New tests/Unit/DriverInstallTest.php (15 tests). It covers task-type registration, who may install, queueing through the core service, an install that is already under way, a refusal from the core's real lock, the creator ignoring package names in the request, the handler installing only the driver's packages, polling, the controller and bootstrap flags, and amount:drivers --install.
  • Full suite: 299 passed, 7 skipped.
  • End to end in the demo CMS, with the real worker:
    • An administrator installed Dropbox from PHP and Bunny over HTTP. In both cases the task went from queued to running to succeeded, and polling reported installed: true.
    • A role holding exec_module and system_tasks.manage_packages but not administrator was refused, checked in PHP.
    • From artisan, amount:drivers --install=zip,s3 installed ZIP and skipped S3, and an unknown id exits 1.
    • The site still boots afterwards.

🤖 Generated with Claude Code

elcreator and others added 2 commits November 16, 2026 02:08
Administrators get an Install button next to a missing driver. The page
queues an `amount.driver_install` system task through the core's
SystemTaskService (its permission, super-administrator gate, exclusive
lock and scheduler checks); system:task-worker runs it with the core's
ConsoleInstallFlowService, so Composer never runs in a web request and a
failed install is rolled back. Requests name a driver, never a package.

`amount:drivers --install=s3,sftp,webdav` installs from a shell, one
package:installrequire run per missing package, and is now the install
hint shown for a missing driver.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elcreator
elcreator merged commit 73a550f into optional-drivers Nov 16, 2026
7 checks passed
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