3 declare(strict_types=1);
51 public function started(
string $class,
int $step): void
56 if ($last_started_step >= $step) {
57 throw new \RuntimeException(
58 "The last started step for $class was $last_started_step, which" .
59 " is higher then the step $step started now." 64 if ($last_started_step !== $last_finished_step) {
65 throw new \RuntimeException(
66 "Step $step should be started for $class, but last step $last_started_step " .
67 "has not finished by now." 74 self::FIELD_CLASS => [
"text", $class],
75 self::FIELD_STEP => [
"integer", $step],
84 public function finished(
string $class,
int $step): void
89 if ($last_started_step != $step) {
90 throw new \RuntimeException(
91 "The step $step for $class is supposed to be finished, but" .
92 " $last_started_step was $step started last." 102 self::FIELD_CLASS => [
"text", $class],
103 self::FIELD_STEP => [
"integer", $step]
112 $res = $this->db->query(
113 "SELECT MAX(" . self::FIELD_STEP .
") AS " . self::FIELD_STEP .
114 " FROM " . self::TABLE_NAME .
115 " WHERE " . self::FIELD_CLASS .
" = " . $this->db->quote($class,
"text")
118 $row = $this->db->fetchAssoc(
$res);
119 return (
int) ($row[self::FIELD_STEP] ?? 0);
126 $res = $this->db->query(
127 "SELECT MAX(" . self::FIELD_STEP .
") AS " . self::FIELD_STEP .
128 " FROM " . self::TABLE_NAME .
129 " WHERE " . self::FIELD_CLASS .
" = " . $this->db->quote($class,
"text") .
130 " AND " . self::FIELD_FINISHED .
" IS NOT NULL" 133 $row = $this->db->fetchAssoc(
$res);
134 return (
int) ($row[self::FIELD_STEP] ?? 0);
139 if (strlen($class) > 200) {
140 throw new \InvalidArgumentException(
141 "This ilDatabaseUpdateStepExecutionLog only supports class names up to 200 chars." 150 throw new \LogicException(
151 "Expected \$get_now to return a DateTime." 154 return $now->format(
"Y-m-d H:i:s.u");
started(string $class, int $step)
finished(string $class, int $step)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
throwIfClassNameTooLong(string $class)
getLastFinishedStep(string $class)
Returns 0 as "first" step.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getLastStartedStep(string $class)
Returns 0 as "first" step.
__construct(ilDBInterface $db, callable $get_now)