ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
InstallCommand.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;
16
21{
22 protected static $defaultName = "install";
23
24 public function configure()
25 {
26 parent::configure();
27 $this->setDescription("Creates a fresh ILIAS installation based on the config");
28 }
29
30 protected function printIntroMessage(IOWrapper $io)
31 {
32 $io->title("Installing ILIAS");
33 }
34
35 protected function printOutroMessage(IOWrapper $io)
36 {
37 $io->success("Installation complete. Thanks and have fun!");
38 }
39
40 public function execute(InputInterface $input, OutputInterface $output)
41 {
42 // ATTENTION: This is a hack to get around the usage of the echo/exit pattern in
43 // the setup for the command line version of the setup. Do not use this.
44 define("ILIAS_SETUP_IGNORE_DB_UPDATE_STEP_MESSAGES", true);
45 return parent::execute($input, $output);
46 }
47
49 {
50 $environment = new ArrayEnvironment([
52 // TODO: This needs to be implemented correctly...
54 public function trackAchievementOf(Objective $objective) : void
55 {
56 }
57 public function isAchieved(Objective $objective) : bool
58 {
59 return false;
60 }
61 }
62 ]);
63
64 if ($agent instanceof AgentCollection && $config) {
65 foreach ($config->getKeys() as $k) {
66 $environment = $environment->withConfigFor($k, $config->getConfig($k));
67 }
68 }
69
70 return $environment;
71 }
72
74 {
75 return new ObjectiveCollection(
76 "Install and update ILIAS",
77 false,
78 $agent->getInstallObjective($config),
79 $agent->getUpdateObjective($config)
80 );
81 }
82}
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