mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-28 02:20:41 +00:00
add new command for checking extensions
This commit is contained in:
parent
b42fdb44c6
commit
a4307a4a2c
71
utils/Commands/CheckextensionCommand.php
Normal file
71
utils/Commands/CheckextensionCommand.php
Normal file
|
|
@ -0,0 +1,71 @@
|
||||||
|
<?php
|
||||||
|
namespace Seeddms\Console\Commands;
|
||||||
|
|
||||||
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
|
use Symfony\Component\Console\Formatter\OutputFormatterStyle;
|
||||||
|
|
||||||
|
|
||||||
|
use Seeddms\Seeddms\Settings;
|
||||||
|
use Seeddms\Seeddms\Translator;
|
||||||
|
use SeedDMS_Core_File;
|
||||||
|
use SeedDMS_View_Common;
|
||||||
|
use SeedDMS_Extension_Mgr;
|
||||||
|
use Log_file;
|
||||||
|
|
||||||
|
class CheckextensionCommand extends Command
|
||||||
|
{
|
||||||
|
protected $settings;
|
||||||
|
|
||||||
|
protected $logger;
|
||||||
|
|
||||||
|
protected $translator;
|
||||||
|
|
||||||
|
protected $extmgr;
|
||||||
|
|
||||||
|
public function __construct(Settings $settings, Log_file $logger, Translator $translator, SeedDMS_Extension_Mgr $extmgr)
|
||||||
|
{
|
||||||
|
$this->settings = $settings;
|
||||||
|
$this->logger = $logger;
|
||||||
|
$this->translator = $translator;
|
||||||
|
$this->extmgr = $extmgr;
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function configure()
|
||||||
|
{
|
||||||
|
$this->setName('ext:check')
|
||||||
|
->setDescription('Check extensions')
|
||||||
|
->setHelp('Checks all installed extensions for completeness and dependencies.')
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function execute(InputInterface $input, OutputInterface $output) : int
|
||||||
|
{
|
||||||
|
$settings = $this->settings;
|
||||||
|
$logger = $this->logger;
|
||||||
|
$translator = $this->translator;
|
||||||
|
$extmgr = $this->extmgr;
|
||||||
|
|
||||||
|
$output->writeln("<comment>Using configuration from '".$settings->_configFilePath."'.</comment>", OutputInterface::VERBOSITY_VERBOSE);
|
||||||
|
|
||||||
|
$extconfs = $extmgr->getExtensionConfiguration();
|
||||||
|
foreach ($extconfs as $extname=>$extconf) {
|
||||||
|
if($extmgr->checkExtensionByDir($extname)) {
|
||||||
|
$output->writeln(sprintf("<info>%s</info>", $extname));
|
||||||
|
} else {
|
||||||
|
$output->writeln(sprintf("<error>%s</error>", $extname));
|
||||||
|
$errmsgs = $extmgr->getErrorMsgs();
|
||||||
|
foreach($errmsgs as $errmsg) {
|
||||||
|
$output->writeln(sprintf("<comment>%s</comment>", $errmsg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Command::SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: ts=4 sw=4 expandtab
|
||||||
|
|
@ -19,6 +19,7 @@ use Seeddms\Console\Commands\ConfigureextensionCommand;
|
||||||
use Seeddms\Console\Commands\UploadextensionCommand;
|
use Seeddms\Console\Commands\UploadextensionCommand;
|
||||||
use Seeddms\Console\Commands\PackageextensionCommand;
|
use Seeddms\Console\Commands\PackageextensionCommand;
|
||||||
use Seeddms\Console\Commands\ReloadextensionCommand;
|
use Seeddms\Console\Commands\ReloadextensionCommand;
|
||||||
|
use Seeddms\Console\Commands\CheckextensionCommand;
|
||||||
use Seeddms\Seeddms\Settings;
|
use Seeddms\Seeddms\Settings;
|
||||||
use Seeddms\Seeddms\Translator;
|
use Seeddms\Seeddms\Translator;
|
||||||
|
|
||||||
|
|
@ -46,6 +47,7 @@ $application->add(new ConfigureextensionCommand($settings, $logger, $translator,
|
||||||
$application->add(new UploadextensionCommand($settings, $logger, $translator, $extmgr));
|
$application->add(new UploadextensionCommand($settings, $logger, $translator, $extmgr));
|
||||||
$application->add(new PackageextensionCommand($settings, $logger, $translator, $extmgr));
|
$application->add(new PackageextensionCommand($settings, $logger, $translator, $extmgr));
|
||||||
$application->add(new ReloadextensionCommand($settings, $logger, $translator, $extmgr));
|
$application->add(new ReloadextensionCommand($settings, $logger, $translator, $extmgr));
|
||||||
|
$application->add(new CheckextensionCommand($settings, $logger, $translator, $extmgr));
|
||||||
|
|
||||||
if(isset($GLOBALS['SEEDDMS_HOOKS']['console'])) {
|
if(isset($GLOBALS['SEEDDMS_HOOKS']['console'])) {
|
||||||
foreach($GLOBALS['SEEDDMS_HOOKS']['console'] as $hookObj) {
|
foreach($GLOBALS['SEEDDMS_HOOKS']['console'] as $hookObj) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user