34 $this->steps_class = $this->steps::class;
45 self::class . $this->steps_class
51 return "Database update steps in $this->steps_class.";
80 $execution_log = $environment->
getResource(ilDatabaseUpdateStepExecutionLog::class);
81 $step_reader = $environment->
getResource(ilDBStepReader::class);
83 $last_started_step = $execution_log->getLastStartedStep($this->steps_class);
84 $last_finished_step = $execution_log->getLastFinishedStep($this->steps_class);
85 if ($last_started_step !== $last_finished_step) {
87 throw new LogicException(
88 "ilDatabaseUpdateStepExecutionLog::throwStepNotFinishedException should throw an exception."
92 if ($last_finished_step === $step_reader->getLatestStepNumber($this->steps_class, self::STEP_METHOD_PREFIX)) {
96 $db = $environment->
getResource(Environment::RESOURCE_DATABASE);
97 $this->steps->prepare($db);
99 $steps = $step_reader->readStepNumbers($this->steps_class, self::STEP_METHOD_PREFIX);
100 foreach ($steps as $step) {
101 if ($step <= $last_finished_step) {
104 $execution_log->started($this->steps_class, $step);
105 $method = self::STEP_METHOD_PREFIX . $step;
106 $this->steps->$method();
107 $execution_log->finished($this->steps_class, $step);
118 $execution_log = $environment->
getResource(ilDatabaseUpdateStepExecutionLog::class);
119 $step_reader = $environment->
getResource(ilDBStepReader::class);
121 return $execution_log->getLastFinishedStep($this->steps_class) !== $step_reader->getLatestStepNumber(
123 self::STEP_METHOD_PREFIX
129 throw new RuntimeException(
130 "For update steps in $this->steps_class: step $started was started " .
131 "last, but step $finished was finished last. Aborting because of that " .
Builds a Color from either hex- or rgb values.
This class attempt to achieve a set of database update steps.
getLabel()
Get a label that describes this objective.
getHash()
The hash for the objective is calculated over the classname and the steps that are contained.
__construct(protected ilDatabaseUpdateSteps $steps)
achieve(Environment $environment)
@inheritdocs
getPreconditions(Environment $environment)
@inheritdocs
isApplicable(Environment $environment)
@inheritDoc
throwStepNotFinishedException(int $started, int $finished)
An environment holds resources to be used in the setup process.
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An objective is a desired state of the system that is supposed to be created by the setup.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...