ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
UpdateCommand.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 2016 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
3
4namespace ILIAS\Setup\CLI;
5
14use Symfony\Component\Console\Input\InputInterface;
15use Symfony\Component\Console\Output\OutputInterface;
16use Symfony\Component\Console\Input\InputOption;
17
22{
23 protected static $defaultName = "update";
24
25 public function configure()
26 {
27 parent::configure();
28 $this
29 ->setDescription("Updates an existing ILIAS installation")
30 ->addOption("ignore-db-update-messages", null, InputOption::VALUE_NONE, "Ignore messages from the database update steps.");
31 }
32
33 protected function printIntroMessage(IOWrapper $io)
34 {
35 $io->title("Updating ILIAS");
36 }
37
38 protected function printOutroMessage(IOWrapper $io)
39 {
40 $io->success("Update complete. Thanks and have fun!");
41 }
42
44 {
45 $environment = new ArrayEnvironment([
47 // TODO: This needs to be implemented correctly...
49 public function trackAchievementOf(Objective $objective) : void
50 {
51 }
52 public function isAchieved(Objective $objective) : bool
53 {
54 return false;
55 }
56 }
57 ]);
58
59 if ($agent instanceof AgentCollection && $config) {
60 foreach ($config->getKeys() as $k) {
61 $environment = $environment->withConfigFor($k, $config->getConfig($k));
62 }
63 }
64
65 return $environment;
66 }
67
68 public function execute(InputInterface $input, OutputInterface $output)
69 {
70 // ATTENTION: This is a hack to get around the usage of the echo/exit pattern in
71 // the setup for the command line version of the setup. Do not use this.
72 if ($input->hasOption("ignore-db-update-messages") && $input->getOption("ignore-db-update-messages")) {
73 define("ILIAS_SETUP_IGNORE_DB_UPDATE_STEP_MESSAGES", true);
74 }
75 return parent::execute($input, $output);
76 }
77
79 {
80 return new ObjectiveCollection(
81 "Update ILIAS",
82 false,
83 $agent->getUpdateObjective($config)
84 );
85 }
86}
An exception for terminatinating execution or to throw for unit testing.
An agent that is just a collection of some other agents.
withConfigFor(string $component, $config)
Stores a config for some component in the environment.RuntimeException if this config is already in t...
Command base class.
Definition: BaseCommand.php:24
Wrapper around symfonies input and output facilities to provide just the functionality required for t...
Definition: IOWrapper.php:17
success(string $text)
Definition: IOWrapper.php:91
title(string $title)
Definition: IOWrapper.php:86
getObjective(Agent $agent, ?Config $config)
execute(InputInterface $input, OutputInterface $output)
buildEnvironment(Agent $agent, ?Config $config, IOWrapper $io)
A objective collection is a objective that is achieved once all subobjectives are achieved.
Tracks the achievement of objectives.
A agent is some component that performs part of the setup process.
Definition: Agent.php:14
A configuration for the setup.
Definition: Config.php:11
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68