80 return "Database update steps in " . get_class($this);
96 $log = $environment->
getResource(\ilDatabaseUpdateStepExecutionLog::class);
99 $finished =
$log->getLastFinishedStep(get_class($this));
125 if ($s <= $finished) {
127 } elseif ($s <= $num) {
143 return end($this->steps);
153 if (!is_null($this->steps)) {
159 foreach (get_class_methods(static::class) as $method) {
160 if (stripos($method, self::STEP_METHOD_PREFIX) !== 0) {
164 $number = substr($method, strlen(self::STEP_METHOD_PREFIX));
166 if (!preg_match(
"/^[1-9]\d*$/", $number)) {
167 throw new \LogicException(
"Method $method seems to be a step but has an odd looking number");
170 $this->steps[(int) $number] = (
int) $number;
An exception for terminatinating execution or to throw for unit testing.
A callable objective wraps a callable into an objective.
A non-objective, nothing to do to achieve it...
This encapsulate one database update step which is a method on some ilDatabaseUpdateSteps-object.
This base-class simplifies the creation of (consecutive) database updates.
__construct(Objective $base)
getHash()
The hash for the objective is calculated over the classname and the steps that are contained.
getSteps()
Get the numbers of the steps in this class.
getLatestStepNum()
Get the number of latest database step in this class.
getAdditionalPreconditionsForStep(int $num)
Get preconditions for steps.
achieve(Environment $environment)
@inheritdocs
getStep(int $num, int $finished=0)
Get a database update step.
getPreconditions(Environment $environment)
@inheritdocs
getLabel()
Get a label that describes this objective.
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.