ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
cli.php File Reference

Go to the source code of this file.

Functions

 get_agent_name_by_class (string $class_name)
 
 setup_exit ($message)
 
 build_container_for_setup (string $executed_in_directory)
 

Variables

 $executed_in_directory = getcwd()
 
 if (!defined("MAGPIE_DIR"))
 
 $c = build_container_for_setup($executed_in_directory)
 
 $app = $c["app"]
 

Function Documentation

◆ build_container_for_setup()

build_container_for_setup ( string  $executed_in_directory)

Definition at line 61 of file cli.php.

References $c, $name, and get_agent_name_by_class().

62 {
63  $c = new \Pimple\Container;
64 
65  $c["app"] = function ($c) {
66  return new \ILIAS\Setup\CLI\App(
67  $c["command.install"],
68  $c["command.update"],
69  $c["command.build-artifacts"],
70  $c["command.reload-control-structure"]
71  );
72  };
73  $c["command.install"] = function ($c) {
74  return new \ILIAS\Setup\CLI\InstallCommand(
75  $c["agent"],
76  $c["config_reader"],
77  $c["common_preconditions"]
78  );
79  };
80  $c["command.update"] = function ($c) {
81  return new \ILIAS\Setup\CLI\UpdateCommand(
82  $c["agent"],
83  $c["config_reader"],
84  $c["common_preconditions"]
85  );
86  };
87  $c["command.build-artifacts"] = function ($c) {
88  return new \ILIAS\Setup\CLI\BuildArtifactsCommand(
89  $c["agent"],
90  $c["config_reader"],
91  []// TODO: $c["common_preconditions"]
92  );
93  };
94  $c["command.reload-control-structure"] = function ($c) {
95  return new \ILIAS\Setup\CLI\ReloadControlStructureCommand(
96  $c["agent"],
97  $c["config_reader"],
98  $c["common_preconditions"]
99  );
100  };
101 
102  $c["common_preconditions"] = function ($c) {
103  return [
104  new \ilOwnRiskConfirmedObjective(),
105  new \ilUseRootConfirmed()
106  ];
107  };
108 
109  $c["agent"] = function ($c) {
110  return function () use ($c) {
111  return new ILIAS\Setup\AgentCollection(
112  $c["ui.field_factory"],
113  $c["refinery"],
114  $c["agents"]
115  );
116  };
117  };
118 
119  $c["agent_finder"] = function ($c) {
121  ILIAS\Setup\Agent::class
122  );
123  };
124 
125  $c["common_agent"] = function ($c) {
126  return new \ilSetupAgent(
127  $c["refinery"],
128  $c["data_factory"],
129  $c["password_manager"]
130  );
131  };
132 
133  $c["agents"] = function ($c) {
134  $agents["common"] = $c["common_agent"];
135  foreach ($c["agent_finder"]->getMatchingClassNames() as $cls) {
136  if (preg_match("/ILIAS\\\\Setup\\\\.*/", $cls)) {
137  continue;
138  }
140  if (isset($agents[$name])) {
141  throw new \RuntimeException(
142  "Encountered duplicate agent $name in $cls"
143  );
144  }
145  $agents[strtolower($name)] = new $cls(
146  $c["refinery"],
147  $c["data_factory"],
148  $c["lng"]
149  );
150  };
151  return $agents;
152  };
153 
154  $c["ui.field_factory"] = function ($c) {
155  return new class implements FieldFactory {
156  public function text($label, $byline = null)
157  {
158  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
159  }
160  public function numeric($label, $byline = null)
161  {
162  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
163  }
164  public function group(array $inputs, string $label = '')
165  {
166  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
167  }
168  public function section(array $inputs, $label, $byline = null)
169  {
170  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
171  }
172  public function dependantGroup(array $inputs)
173  {
174  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
175  }
176  public function optionalGroup(array $inputs, string $label, string $byline = null) : \ILIAS\UI\Component\Input\Field\OptionalGroup
177  {
178  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
179  }
180  public function switchableGroup(array $inputs, string $label, string $byline = null) : \ILIAS\UI\Component\Input\Field\SwitchableGroup
181  {
182  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
183  }
184  public function checkbox($label, $byline = null)
185  {
186  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
187  }
188  public function tag(string $label, array $tags, $byline = null) : Tag
189  {
190  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
191  }
192  public function password($label, $byline = null)
193  {
194  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
195  }
196  public function select($label, array $options, $byline = null)
197  {
198  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
199  }
200  public function textarea($label, $byline = null)
201  {
202  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
203  }
204  public function radio($label, $byline = null)
205  {
206  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
207  }
208  public function multiSelect($label, array $options, $byline = null)
209  {
210  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
211  }
212  public function dateTime($label, $byline = null)
213  {
214  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
215  }
216  public function duration($label, $byline = null)
217  {
218  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
219  }
220  public function file(UploadHandler $handler, string $label, string $byline = null) : File
221  {
222  throw new \LogicException("The CLI-setup does not support the UI-Framework.");
223  }
224  };
225  };
226 
227  $c["refinery"] = function ($c) {
228  return new ILIAS\Refinery\Factory(
229  $c["data_factory"],
230  $c["lng"]
231  );
232  };
233 
234  $c["data_factory"] = function ($c) {
235  return new ILIAS\Data\Factory();
236  };
237 
238  $c["lng"] = function ($c) {
239  return new \ilSetupLanguage("en");
240  };
241 
242  $c["config_reader"] = function ($c) use ($executed_in_directory) {
243  return new \ILIAS\Setup\CLI\ConfigReader(
245  );
246  };
247 
248  $c["password_manager"] = function ($c) {
249  return new \ilSetupPasswordManager([
250  'password_encoder' => 'bcryptphp',
251  'encoder_factory' => new \ilSetupPasswordEncoderFactory([
252  'default_password_encoder' => 'bcryptphp'
253  ])
254  ]);
255  };
256 
257  return $c;
258 }
Class Factory.
$c
Definition: cli.php:37
Class ChatMainBarProvider .
if($format !==null) $name
Definition: metadata.php:230
$executed_in_directory
Definition: cli.php:5
get_agent_name_by_class(string $class_name)
Definition: cli.php:41
This describes file field.
Definition: File.php:8
+ Here is the call graph for this function:

◆ get_agent_name_by_class()

get_agent_name_by_class ( string  $class_name)

Definition at line 41 of file cli.php.

Referenced by build_container_for_setup().

41  : string
42 {
43  // We assume that the name of an agent in the class ilXYZSetupAgent really
44  // is XYZ. If that does not fit we just use the class name.
45  $match = [];
46  if (preg_match("/il(\w+)SetupAgent/", $class_name, $match)) {
47  return $match[1];
48  }
49  return $class_name;
50 }
+ Here is the caller graph for this function:

◆ setup_exit()

setup_exit (   $message)

Definition at line 54 of file cli.php.

References $message.

55 {
56  if (!defined("ILIAS_SETUP_IGNORE_DB_UPDATE_STEP_MESSAGES") || !ILIAS_SETUP_IGNORE_DB_UPDATE_STEP_MESSAGES) {
57  throw new \ILIAS\Setup\UnachievableException($message);
58  }
59 }
$message
Definition: xapiexit.php:14

Variable Documentation

◆ $app

$app = $c["app"]

Definition at line 38 of file cli.php.

Referenced by ilCalendarExport\addAppointment(), ilCalendarExport\addAppointments(), ilCalendarWeekGUI\addTimedEvents(), ilCalendarMailNotification\appendAppointmentDetails(), ilCalendarCategoryGUI\askDeleteAppointments(), ilConsultationHoursGUI\assignUsersToAppointment(), ilConsultationHoursGUI\assignUsersToAppointments(), ilConsultationHoursGUI\assignUsersToGroup(), ilConsultationHourUtils\bookAppointment(), ilConsultationHourUtils\cancelBooking(), ilAppointmentPresentationGroupGUI\collectPropertiesAndActions(), ilAppointmentPresentationCourseGUI\collectPropertiesAndActions(), ilCalendarAppEventListener\createAppointments(), ilCalendarExport\createRecurrences(), ilCalendarExport\createVEVENT(), ilCalendarCategoryGUI\deleteAppointments(), ilCalendarMonthGUI\executeCommand(), ilCalendarWeekGUI\executeCommand(), ilCalendarInboxGUI\executeCommand(), ilCalendarDayGUI\executeCommand(), ilCalendarAppointmentPresentationGUI\executeCommand(), ilCalendarCategoryGUI\executeCommand(), ilCalendarPresentationGUI\executeCommand(), ilMilestoneResponsiblesTableGUI\getParticipantsAndResponsibles(), ilExAssignment\handleCalendarEntries(), ilSessionDataSet\importRecord(), ilSurveySkillDeterminationGUI\listSkillChanges(), ilConsultationHourBookingTableGUI\parse(), ilConsultationHoursTableGUI\parse(), ilCalendarWeekGUI\parseHourInfo(), ilCalendarDayGUI\parseInfoIntoRaster(), ilObjGroup\prepareAppointments(), ilObjCourse\prepareAppointments(), ilObjSession\prepareCalendarAppointments(), ilObjSurvey\sent360Reminders(), and ilSurveySkillDeterminationGUI\writeAndAddSkills().

◆ $c

$c = build_container_for_setup($executed_in_directory)

Definition at line 37 of file cli.php.

Referenced by build_container_for_setup().

◆ $executed_in_directory

$executed_in_directory = getcwd()

Definition at line 5 of file cli.php.

◆ if

if(!defined("MAGPIE_DIR"))

Definition at line 13 of file cli.php.