ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Setup\CLI Namespace Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

Data Structures

class  AchieveCommand
 Achieves an objective. More...
 
class  App
 The ILIAS-setup-console-application. More...
 
class  BuildCommand
 Installation command. More...
 
class  ConfigReader
 Read a json-formatted config from a file and overwrite some fields. More...
 
class  ImportFileUnzippedFileObjective
 
class  InstallCommand
 Installation command. More...
 
class  IOWrapper
 Wrapper around symfonies input and output facilities to provide just the functionality required for the ILIAS-setup. More...
 
class  MigrateCommand
 Migration command. More...
 
class  StatusCommand
 Command to output status information about the installation. More...
 
class  UpdateCommand
 Update command. More...
 

Functions

 configureCommandForPlugins ()
 
 getRelevantAgent (InputInterface $input)
 
 readAgentConfig (Agent $agent, InputInterface $input, ?string $use_config_field=null)
 
 addAgentConfigsToEnvironment (Agent $agent, Config $config, Environment $environment)
 
 isConfigInRoot (string $config_file)
 

Variables

trait HasAgent
 Add this to an Command that has an agent. More...
 
trait HasConfigReader
 Add this to an Command that has an config reader. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Function Documentation

◆ addAgentConfigsToEnvironment()

ILIAS\Setup\CLI\addAgentConfigsToEnvironment ( Agent  $agent,
Config  $config,
Environment  $environment 
)
protected

Definition at line 70 of file HasConfigReader.php.

References ILIAS\Setup\Environment\withConfigFor().

Referenced by ILIAS\Setup\CLI\UpdateCommand\execute(), ILIAS\Setup\CLI\AchieveCommand\executeAchieveObjective(), ILIAS\Setup\CLI\InstallCommand\prepareILIASInstallation(), and ILIAS\Setup\CLI\InstallCommand\preparePluginInstallation().

74  : Environment {
75  if ($agent instanceof AgentCollection) {
76  foreach ($config->getKeys() as $k) {
77  $environment = $environment->withConfigFor($k, $config->getConfig($k));
78  }
79  }
80 
81  return $environment;
82  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ configureCommandForPlugins()

ILIAS\Setup\CLI\configureCommandForPlugins ( )
protected

Definition at line 33 of file HasAgent.php.

References null.

Referenced by ILIAS\Setup\CLI\StatusCommand\configure(), ILIAS\Setup\CLI\BuildCommand\configure(), ILIAS\Setup\CLI\MigrateCommand\configure(), ILIAS\Setup\CLI\UpdateCommand\configure(), and ILIAS\Setup\CLI\InstallCommand\configure().

33  : void
34  {
35  $this->addOption("legacy-plugin", null, InputOption::VALUE_REQUIRED, "Name of the plugin to run the command for.");
36  $this->addOption("no-legacy-plugins", null, InputOption::VALUE_NONE, "Ignore all plugins when running the command.");
37  $this->addOption("skip-legacy-plugin", null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, "Skip plugin with the supplied <plugin-name> when running the command.");
38  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the caller graph for this function:

◆ getRelevantAgent()

ILIAS\Setup\CLI\getRelevantAgent ( InputInterface  $input)
protected

Definition at line 40 of file HasAgent.php.

Referenced by ILIAS\Setup\CLI\StatusCommand\execute(), ILIAS\Setup\CLI\BuildCommand\execute(), ILIAS\Setup\CLI\UpdateCommand\execute(), ILIAS\Setup\CLI\AchieveCommand\executeAchieveObjective(), ILIAS\Setup\CLI\MigrateCommand\listMigrations(), ILIAS\Setup\CLI\InstallCommand\prepareILIASInstallation(), ILIAS\Setup\CLI\InstallCommand\preparePluginInstallation(), ILIAS\Setup\CLI\MigrateCommand\runMigration(), and ILIAS\Tests\Setup\CLI\HasAgentTest\setUp().

40  : Agent
41  {
42  if (!$this->agent_finder) {
43  throw new \LogicException(
44  "\$this->agent_finder needs to intialized with an AgentFinder."
45  );
46  }
47 
48  if ($input->hasOption("no-legacy-plugins") && $input->getOption("no-legacy-plugins")) {
49  // The agents of the core are in all folders but the customizing folder.
50  return $this->agent_finder->getComponentAgents();
51  }
52 
53  if ($input->hasOption("legacy-plugin")) {
54  $plugin_name = $input->getOption("legacy-plugin");
55  if ($plugin_name) {
56  return $this->agent_finder->getPluginAgent($plugin_name);
57  }
58  }
59 
60  $agents = $this->agent_finder->getAgents();
61  if ($input->hasOption("skip-legacy-plugin")) {
62  foreach (($input->getOption("skip-legacy-plugin") ?? []) as $plugin_name) {
63  $agents = $agents->withRemovedAgent($plugin_name);
64  }
65  }
66 
67  return $agents;
68  }
+ Here is the caller graph for this function:

◆ isConfigInRoot()

ILIAS\Setup\CLI\isConfigInRoot ( string  $config_file)
protected

Definition at line 84 of file HasConfigReader.php.

Referenced by ILIAS\Setup\CLI\readAgentConfig().

84  : bool
85  {
86  $webroot = realpath(__DIR__ . "/../../../../../");
87  $config_file = realpath($config_file);
88 
89  $common_prefix = substr($config_file, 0, strlen($webroot));
90  return $webroot === $common_prefix;
91  }
+ Here is the caller graph for this function:

◆ readAgentConfig()

ILIAS\Setup\CLI\readAgentConfig ( Agent  $agent,
InputInterface  $input,
?string  $use_config_field = null 
)
protected

Definition at line 36 of file HasConfigReader.php.

References ILIAS\Setup\CLI\isConfigInRoot(), and null.

Referenced by ILIAS\Setup\CLI\UpdateCommand\execute(), ILIAS\Setup\CLI\AchieveCommand\executeAchieveObjective(), ILIAS\Setup\CLI\InstallCommand\prepareILIASInstallation(), ILIAS\Setup\CLI\InstallCommand\preparePluginInstallation(), and ILIAS\Tests\Setup\CLI\HasConfigReaderTest\setUp().

36  : ?Config
37  {
38  if (!($this->config_reader instanceof ConfigReader)) {
39  throw new \LogicException("\$this->config_reader not properly initialized.");
40  }
41 
42  if (!$agent->hasConfig()) {
43  return null;
44  }
45 
46  $config_file = $input->getArgument("config");
47  if ($this->isConfigInRoot($config_file)) {
48  throw new \LogicException("Thou shall not put your config file in the webroot!!");
49  }
50 
51  $config_overwrites_raw = $input->getOption("config");
52  $config_overwrites = [];
53  foreach ($config_overwrites_raw as $o) {
54  $vs = explode("=", $o);
55  if (count($vs) !== 2) {
56  throw new \Exception("Cannot read config-option: '$o'");
57  }
58  $config_overwrites[$vs[0]] = $vs[1];
59  }
60 
61  $config_content = $this->config_reader->readConfigFile($config_file, $config_overwrites);
62  if ($use_config_field !== null) {
63  $config_content = $config_content[$use_config_field] ?? null;
64  }
65 
66  $trafo = $agent->getArrayToConfigTransformation();
67  return $trafo->transform($config_content);
68  }
isConfigInRoot(string $config_file)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ HasAgent

trait ILIAS::Setup::CLI\HasAgent
Initial value:
{
protected ?AgentFinder $agent_finder = null
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

Add this to an Command that has an agent.

Definition at line 30 of file HasAgent.php.

Referenced by ILIAS\Tests\Setup\CLI\HasAgentTest\setUp().

◆ HasConfigReader

trait ILIAS::Setup::CLI\HasConfigReader
Initial value:
{
protected ConfigReader $config_reader

Add this to an Command that has an config reader.

Definition at line 30 of file HasConfigReader.php.

Referenced by ILIAS\Tests\Setup\CLI\HasConfigReaderTest\setUp().