ILIAS  release_7 Revision v7.30-3-g800a261c036
ILIAS\Setup\CLI\AchieveCommand Class Reference

Achieves an objective. More...

+ Inheritance diagram for ILIAS\Setup\CLI\AchieveCommand:
+ Collaboration diagram for ILIAS\Setup\CLI\AchieveCommand:

Public Member Functions

 __construct (AgentFinder $agent_finder, ConfigReader $config_reader, array $preconditions, Refinery $refinery)
 
 configure ()
 
 execute (InputInterface $input, OutputInterface $output)
 

Protected Member Functions

 parseAgentMethod (string $agent_method)
 

Protected Attributes

 $preconditions
 var Objective[] More...
 
 $refinery
 

Static Protected Attributes

static $defaultName = "achieve"
 

Detailed Description

Achieves an objective.

Definition at line 24 of file AchieveCommand.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Setup\CLI\AchieveCommand::__construct ( AgentFinder  $agent_finder,
ConfigReader  $config_reader,
array  $preconditions,
Refinery  $refinery 
)

Definition at line 45 of file AchieveCommand.php.

50 {
52 $this->agent_finder = $agent_finder;
53 $this->config_reader = $config_reader;
54 $this->preconditions = $preconditions;
55 $this->refinery = $refinery;
56 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\Setup\CLI\AchieveCommand\$preconditions, ILIAS\Setup\CLI\AchieveCommand\$refinery, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ configure()

ILIAS\Setup\CLI\AchieveCommand::configure ( )

Definition at line 58 of file AchieveCommand.php.

59 {
60 $this->setDescription("Achieve a named objective from an agent.");
61 $this->addArgument("objective", InputArgument::REQUIRED, "Objective to be execute from an agent. Format: \$AGENT::\$OBJECTIVE");
62 $this->addArgument("config", InputArgument::OPTIONAL, "Configuration file for the installation");
63 $this->addOption("config", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, "Define fields in the configuration file that should be overwritten, e.g. \"a.b.c=foo\"", []);
64 $this->addOption("yes", "y", InputOption::VALUE_NONE, "Confirm every message of the update.");
65 }

◆ execute()

ILIAS\Setup\CLI\AchieveCommand::execute ( InputInterface  $input,
OutputInterface  $output 
)

Definition at line 67 of file AchieveCommand.php.

68 {
69 $objective_name = $input->getArgument('objective');
70
71 $io = new IOWrapper($input, $output);
72 $io->printLicenseMessage();
73 $io->title("Achieve objective: $objective_name");
74
75 $agent = $this->getRelevantAgent($input);
76
77 if ($input->getArgument("config")) {
78 $config = $this->readAgentConfig($agent, $input);
79 } else {
80 $config = null;
81 }
82
83 $objective = $agent->getNamedObjective($objective_name, $config);
84
85 if (count($this->preconditions) > 0) {
86 $objective = new ObjectiveWithPreconditions(
87 $objective,
88 ...$this->preconditions
89 );
90 }
91
92 $environment = new ArrayEnvironment([
94 ]);
95 if ($config) {
96 $environment = $this->addAgentConfigsToEnvironment($agent, $config, $environment);
97 }
98
99 try {
100 $this->achieveObjective($objective, $environment, $io);
101 $io->success("Achieved objective '$objective_name'. Thanks and have fun!");
102 } catch (NoConfirmationException $e) {
103 $io->error("Aborted the attempt to achieve '$objective_name', a necessary confirmation is missing:\n\n" . $e->getRequestedConfirmation());
104 }
105 }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
addAgentConfigsToEnvironment(Agent $agent, Config $config, Environment $environment)
getRelevantAgent(InputInterface $input)
Definition: HasAgent.php:28
readAgentConfig(Agent $agent, InputInterface $input)

References $config, Vendor\Package\$e, ILIAS\Setup\CLI\addAgentConfigsToEnvironment(), ILIAS\Setup\CLI\getRelevantAgent(), ILIAS\Setup\CLI\readAgentConfig(), and ILIAS\Setup\Environment\RESOURCE_ADMIN_INTERACTION.

+ Here is the call graph for this function:

◆ parseAgentMethod()

ILIAS\Setup\CLI\AchieveCommand::parseAgentMethod ( string  $agent_method)
protected

Definition at line 107 of file AchieveCommand.php.

107 : ?array
108 {
109 $result = [];
110 if (!preg_match('/^\s*(\w+)::(\w+)\s*$/', $agent_method, $result)) {
111 return null;
112 }
113
114 return [$result[1], $result[2]];
115 }
$result

References $result.

Field Documentation

◆ $defaultName

ILIAS\Setup\CLI\AchieveCommand::$defaultName = "achieve"
staticprotected

Definition at line 30 of file AchieveCommand.php.

◆ $preconditions

ILIAS\Setup\CLI\AchieveCommand::$preconditions
protected

var Objective[]

Definition at line 35 of file AchieveCommand.php.

Referenced by ILIAS\Setup\CLI\AchieveCommand\__construct().

◆ $refinery

ILIAS\Setup\CLI\AchieveCommand::$refinery
protected

Definition at line 40 of file AchieveCommand.php.

Referenced by ILIAS\Setup\CLI\AchieveCommand\__construct().


The documentation for this class was generated from the following file: