Files
breadcrumb-the-shire/lib/Console/Commands/Module/DeactivateCommand.php
fs 7121732fcf refactor(cli)!: hard-cut legacy scripts and standardize console runtime
- remove legacy bin/module-*.php and bin/doctor.php entry scripts

- move module/doctor execution into class-based runners under lib/Console

- add stable JSON output for doctor and module:sync

- introduce bin/dev for init/up/down/logs/console/qa workflow

- update DI wiring, phpstan scan config, tests, and docs to new CLI contract
2026-04-01 17:14:20 +02:00

50 lines
1.2 KiB
PHP

<?php
namespace MintyPHP\Console\Commands\Module;
final class DeactivateCommand extends AbstractModuleCommand
{
public function name(): string
{
return 'module:deactivate';
}
public function description(): string
{
return 'Run a module\'s deactivation handler';
}
public function usage(): string
{
return <<<'USAGE'
Usage: php bin/console module:deactivate <module-id> [options]
Options:
--confirm Execute the deactivation handler
--dry-run Validate the handler without executing
The module does not need to be in the enabled list.
USAGE;
}
public function execute(array $args, array $options): int
{
$moduleId = $args[0] ?? '';
if ($moduleId === '') {
fwrite(STDERR, $this->usage() . "\n");
return 1;
}
$result = $this->moduleRunner()->deactivate(
$moduleId,
(bool) ($options['confirm'] ?? false),
(bool) ($options['dry-run'] ?? false)
);
$stream = $result['exit_code'] === 0 ? STDOUT : STDERR;
fwrite($stream, $result['message'] . PHP_EOL);
return (int) $result['exit_code'];
}
}