1<?
php declare(strict_types=1);
13use Symfony\Component\Console\Command\Command;
14use Symfony\Component\Console\Input\InputInterface;
15use Symfony\Component\Console\Output\OutputInterface;
16use Symfony\Component\Console\Input\InputArgument;
17use Symfony\Component\Console\Input\InputOption;
41 $this->agent_finder = $agent_finder;
42 $this->config_reader = $config_reader;
48 $this->setDescription(
"Updates an existing ILIAS installation");
49 $this->addArgument(
"config", InputArgument::OPTIONAL,
"Configuration file for the update");
50 $this->addOption(
"config",
null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
"Define fields in the configuration file that should be overwritten, e.g. \"a.b.c=foo\"", []);
51 $this->addOption(
"ignore-db-update-messages",
null, InputOption::VALUE_NONE,
"Ignore messages from the database update steps.");
52 $this->addOption(
"yes",
"y", InputOption::VALUE_NONE,
"Confirm every message of the update.");
56 public function execute(InputInterface $input, OutputInterface $output)
60 if ($input->hasOption(
"ignore-db-update-messages") && $input->getOption(
"ignore-db-update-messages")) {
61 define(
"ILIAS_SETUP_IGNORE_DB_UPDATE_STEP_MESSAGES",
true);
65 $io->printLicenseMessage();
66 $io->title(
"Update ILIAS");
70 if ($input->getArgument(
"config")) {
76 $objective = $agent->getUpdateObjective(
$config);
77 if (count($this->preconditions) > 0) {
80 ...$this->preconditions
92 $this->achieveObjective($objective, $environment, $io);
93 $io->success(
"Update complete. Thanks and have fun!");
95 $io->error(
"Aborting Update, a necessary confirmation is missing:\n\n" .
$e->getRequestedConfirmation());
An exception for terminatinating execution or to throw for unit testing.
Read a json-formatted config from a file and overwrite some fields.
Wrapper around symfonies input and output facilities to provide just the functionality required for t...
$preconditions
var Objective[]
execute(InputInterface $input, OutputInterface $output)
__construct(AgentFinder $agent_finder, ConfigReader $config_reader, array $preconditions)
Signals that a necessary confirmation from the admin is missing.
A wrapper around an objective that adds some preconditions.
An environment holds resources to be used in the setup process.
const RESOURCE_ADMIN_INTERACTION
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addAgentConfigsToEnvironment(Agent $agent, Config $config, Environment $environment)
trait HasAgent
Add this to an Command that has an agent.
getRelevantAgent(InputInterface $input)
readAgentConfig(Agent $agent, InputInterface $input)
trait HasConfigReader
Add this to an Command that has an config reader.
configureCommandForPlugins()