mirror of
https://github.com/slawkens/myaac.git
synced 2025-11-28 06:06:51 +01:00
plugin:unistall command
This commit is contained in:
40
system/src/Commands/PluginUninstallCommand.php
Normal file
40
system/src/Commands/PluginUninstallCommand.php
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace MyAAC\Commands;
|
||||||
|
|
||||||
|
use MyAAC\Plugins;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
|
|
||||||
|
class PluginUninstallCommand extends Command
|
||||||
|
{
|
||||||
|
protected function configure(): void
|
||||||
|
{
|
||||||
|
$this->setName('plugin:uninstall')
|
||||||
|
->setDescription('This command uninstalls plugin')
|
||||||
|
->addArgument('plugin-name', InputArgument::REQUIRED, 'Plugin that you want to uninstall');
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output): int
|
||||||
|
{
|
||||||
|
require SYSTEM . 'init.php';
|
||||||
|
|
||||||
|
$io = new SymfonyStyle($input, $output);
|
||||||
|
|
||||||
|
$pluginName = $input->getArgument('plugin-name');
|
||||||
|
|
||||||
|
if (!Plugins::uninstall($pluginName)) {
|
||||||
|
$io->error('Error while uninstalling plugin ' . $pluginName . ': ' . Plugins::getError());
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach(Plugins::getWarnings() as $warning) {
|
||||||
|
$io->warning($warning);
|
||||||
|
}
|
||||||
|
|
||||||
|
$io->success($pluginName . ' plugin has been successfully installed.');
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user