catchAdmin/extend/catcher/command/install/EnableModuleCommand.php

41 lines
1.5 KiB
PHP
Raw Normal View History

2020-06-24 10:07:11 +08:00
<?php
// +----------------------------------------------------------------------
// | CatchAdmin [Just Like ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017~2020 http://catchadmin.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( https://github.com/yanwenwu/catch-admin/blob/master/LICENSE.txt )
// +----------------------------------------------------------------------
// | Author: JaguarJack [ njphper@gmail.com ]
// +----------------------------------------------------------------------
namespace catcher\command\install;
use catchAdmin\permissions\model\Permissions;
2020-06-24 10:07:11 +08:00
use catcher\CatchAdmin;
use catcher\library\InstallLocalModule;
2020-06-24 10:07:11 +08:00
use think\console\Command;
use think\console\Input;
use think\console\input\Argument;
use think\console\Output;
class EnableModuleCommand extends Command
{
protected function configure()
{
$this->setName('enable:module')
->addArgument('module', Argument::REQUIRED, 'module name')
->setDescription('enable catch module');
}
protected function execute(Input $input, Output $output)
{
$module = $input->getArgument('module');
if (empty(CatchAdmin::getModuleInfo(CatchAdmin::directory() .$module))) {
$output->error("module [$module] not exist");
} else {
(new InstallLocalModule($module))->enableModule();
2020-06-24 10:07:11 +08:00
$output->info("module [$module] enabled");
}
}
}