settings = $settings; $this->logger = $logger; $this->translator = $translator; $this->extmgr = $extmgr; parent::__construct(); } protected function configure() { $this->setName('ext:upload') ->setDescription('Upload extension') ->setHelp('Uploads an extensions, which replaces an exiting extension or inserts a new extension.') ->addOption('file', '', InputOption::VALUE_REQUIRED, 'Filename of zipped extension.', null) ; } protected function execute(InputInterface $input, OutputInterface $output) : int { $settings = $this->settings; $logger = $this->logger; $translator = $this->translator; $extmgr = $this->extmgr; $output->writeln("Using configuration from '".$settings->_configFilePath."'.", OutputInterface::VERBOSITY_VERBOSE); /* if (!is_writable($settings->_configFilePath)) { $output->writeln(sprintf("The configuration file '%s' is not writable by the system user running this script.", $settings->_configFilePath)); return Command::FAILURE; } */ if (!is_writable($settings->_cacheDir)) { $output->writeln(sprintf("The cache dir '%s' is not writable for the system user running this script.", $settings->_cacheDir)); return Command::FAILURE; } $filename = $input->getOption('file'); if (!$extmgr->updateExtension($filename)) { foreach ($extmgr->getErrorMsgs() as $msg) { $output->writeln(sprintf("%s", $msg)); } return Command::FAILURE; } return Command::SUCCESS; } } // vim: ts=4 sw=4 expandtab