mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-11-27 18:10:42 +00:00
69 lines
2.0 KiB
PHP
69 lines
2.0 KiB
PHP
<?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 ReloadextensionCommand 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:reload')
|
|
->setDescription('Reload extensions')
|
|
->setHelp('Recreates the cached extension list.')
|
|
;
|
|
}
|
|
|
|
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);
|
|
|
|
if (!is_writable($settings->_cacheDir)) {
|
|
$output->writeln(sprintf("<error>The cache directory '%s' is not writable by the system user running this script.</error>", $settings->_cacheDir));
|
|
return Command::FAILURE;
|
|
}
|
|
if($extmgr->createExtensionConf()) {
|
|
return Command::SUCCESS;
|
|
} else {
|
|
$output->writeln(sprintf("<error>Failed to recreate the extension list.'</error>"));
|
|
return Command::FAILURE;
|
|
}
|
|
}
|
|
}
|
|
|
|
// vim: ts=4 sw=4 expandtab
|