ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
cli.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
6 chdir(__DIR__ . "/..");
7 
8 require_once(__DIR__ . "/../libs/composer/vendor/autoload.php");
9 
10 require_once(__DIR__ . "/../include/inc.ilias_version.php");
11 
12 // according to ./Services/Feeds/classes/class.ilExternalFeed.php:
13 if (!defined("MAGPIE_DIR")) {
14  define("MAGPIE_DIR", "./Services/Feeds/magpierss/");
15 }
16 
17 require_once(__DIR__ . "/classes/class.ilSetupObjective.php");
18 require_once(__DIR__ . "/classes/class.ilSetupAgent.php");
19 require_once(__DIR__ . "/classes/class.ilSetupConfig.php");
20 require_once(__DIR__ . "/classes/class.ilMakeInstallationAccessibleObjective.php");
21 require_once(__DIR__ . "/classes/class.ilUseRootConfirmed.php");
22 require_once(__DIR__ . "/classes/class.ilOwnRiskConfirmedObjective.php");
23 require_once(__DIR__ . "/classes/class.ilOverwritesExistingInstallationConfirmed.php");
24 require_once(__DIR__ . "/classes/class.ilIniFilesPopulatedObjective.php");
25 require_once(__DIR__ . "/classes/class.ilIniFilesLoadedObjective.php");
26 require_once(__DIR__ . "/classes/class.ilNICKeyRegisteredObjective.php");
27 require_once(__DIR__ . "/classes/class.ilNICKeyStoredObjective.php");
28 require_once(__DIR__ . "/classes/class.ilSetupConfigStoredObjective.php");
29 require_once(__DIR__ . "/classes/class.ilSetupMetricsCollectedObjective.php");
30 
31 use ILIAS\UI\Component\Input\Field\Factory as FieldFactory;
35 use ILIAS\UI\Component\Input\Field\ViewControl\Factory as ViewControlFactory;
36 
38 $app = $c["app"];
39 $app->run();
40 
41 // ATTENTION: This is a hack to get around the usage of the echo/exit pattern in
42 // the setup for the command line version of the setup. Do not use this.
44 {
45  if (!defined("ILIAS_SETUP_IGNORE_DB_UPDATE_STEP_MESSAGES") || !ILIAS_SETUP_IGNORE_DB_UPDATE_STEP_MESSAGES) {
46  throw new \ILIAS\Setup\UnachievableException($message);
47  }
48 }
49 
51 {
52  $c = new \Pimple\Container;
53 
54  $c["app"] = function ($c) {
55  return new \ILIAS\Setup\CLI\App(
56  $c["command.install"],
57  $c["command.update"],
58  $c["command.build-artifacts"],
59  $c["command.achieve"],
60  $c["command.status"],
61  $c["command.migrate"]
62  );
63  };
64  $c["command.install"] = function ($c) {
65  return new \ILIAS\Setup\CLI\InstallCommand(
66  $c["agent_finder"],
67  $c["config_reader"],
68  $c["common_preconditions"]
69  );
70  };
71  $c["command.update"] = function ($c) {
72  return new \ILIAS\Setup\CLI\UpdateCommand(
73  $c["agent_finder"],
74  $c["config_reader"],
75  $c["common_preconditions"]
76  );
77  };
78  $c["command.build-artifacts"] = function ($c) {
79  return new \ILIAS\Setup\CLI\BuildArtifactsCommand(
80  $c["agent_finder"]
81  );
82  };
83  $c["command.achieve"] = function ($c) {
84  return new \ILIAS\Setup\CLI\AchieveCommand(
85  $c["agent_finder"],
86  $c["config_reader"],
87  $c["common_preconditions"],
88  $c["refinery"]
89  );
90  };
91  $c["command.status"] = function ($c) {
92  return new \ILIAS\Setup\CLI\StatusCommand(
93  $c["agent_finder"]
94  );
95  };
96 
97  $c["command.migrate"] = function ($c) {
98  return new \ILIAS\Setup\CLI\MigrateCommand(
99  $c["agent_finder"],
100  $c["common_preconditions"]
101  );
102  };
103 
104  $c["common_preconditions"] = function ($c) {
105  return [
106  new \ilOwnRiskConfirmedObjective(),
107  new \ilUseRootConfirmed()
108  ];
109  };
110 
111  $c["common_agent"] = function ($c) {
112  return new \ilSetupAgent(
113  $c["refinery"],
114  $c["data_factory"]
115  );
116  };
117 
118  $c["agent_finder"] = function ($c) {
120  $c["refinery"],
121  $c["data_factory"],
122  $c["lng"],
123  $c["interface_finder"],
124  $c["plugin_raw_reader"],
125  [
126  "common" => $c["common_agent"]
127  ]
128  );
129  };
130 
131  $c["refinery"] = function ($c) {
132  return new ILIAS\Refinery\Factory(
133  $c["data_factory"],
134  $c["lng"]
135  );
136  };
137 
138  $c["data_factory"] = function ($c) {
139  return new ILIAS\Data\Factory();
140  };
141 
142  $c["lng"] = function ($c) {
143  return new \ilSetupLanguage("en");
144  };
145 
146  $c["config_reader"] = function ($c) use ($executed_in_directory) {
147  return new \ILIAS\Setup\CLI\ConfigReader(
148  $executed_in_directory
149  );
150  };
151 
152  $c["interface_finder"] = function ($c) {
153  return new \ILIAS\Setup\ImplementationOfInterfaceFinder();
154  };
155 
156  $c["plugin_raw_reader"] = function ($c) {
157  return new \ilPluginRawReader();
158  };
159 
160  return $c;
161 }
This is what a factory for input fields looks like.
Definition: Factory.php:10
$app
Definition: cli.php:38
$c
Definition: cli.php:37
$executed_in_directory
Definition: cli.php:5
setup_exit($message)
Definition: cli.php:43
$message
Definition: xapiexit.php:14
build_container_for_setup(string $executed_in_directory)
Definition: cli.php:50