- 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
36 lines
966 B
PHP
36 lines
966 B
PHP
<?php
|
|
|
|
namespace MintyPHP\Console\Commands\Module;
|
|
|
|
final class PermissionsSyncCommand extends AbstractModuleCommand
|
|
{
|
|
public function name(): string
|
|
{
|
|
return 'module:permissions-sync';
|
|
}
|
|
|
|
public function description(): string
|
|
{
|
|
return 'Sync module permissions to DB and deactivate orphaned ones';
|
|
}
|
|
|
|
public function execute(array $args, array $options): int
|
|
{
|
|
$result = $this->moduleRunner()->permissionsSync();
|
|
fwrite(STDOUT, sprintf(
|
|
"module-permissions-sync: created=%d updated=%d unchanged=%d deactivated=%d total=%d\n",
|
|
$result['created'],
|
|
$result['updated'],
|
|
$result['unchanged'],
|
|
$result['deactivated'],
|
|
$result['total']
|
|
));
|
|
|
|
if ($result['message'] !== 'module-permissions-sync: ok') {
|
|
fwrite(STDOUT, $result['message'] . PHP_EOL);
|
|
}
|
|
|
|
return (int) $result['exit_code'];
|
|
}
|
|
}
|