ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilCtrlStructureStoredObjective.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2
4
6{
7 const TABLE_CLASSFILES = "ctrl_classfile";
8 const TABLE_CALLS = "ctrl_calls";
9
13 protected $ctrl_reader;
14
19
21 {
22 $this->ctrl_reader = $ctrl_reader;
23 $this->populate_before = $populate_before;
24 }
25
29 public function getHash() : string
30 {
31 return hash("sha256", self::class);
32 }
33
37 public function getLabel() : string
38 {
39 return "ilCtrl-structure is read and stored.";
40 }
41
45 public function isNotable() : bool
46 {
47 return true;
48 }
49
53 public function getPreconditions(Setup\Environment $environment) : array
54 {
55 $config = $environment->getConfigFor('database');
56 return [
57 new \ilDatabaseUpdatedObjective($config, $this->populate_before)
58 ];
59 }
60
64 public function achieve(Setup\Environment $environment) : Setup\Environment
65 {
66 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
67 if (!$db) {
68 throw new \UnachievableException("Need DB to store control-structure");
69 }
70
71 if (!defined("ILIAS_ABSOLUTE_PATH")) {
72 define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
73 }
74
75 $reader = $this->ctrl_reader->withDB($db);
76 $reader->executed = false;
77 $reader->readStructure(true);
78 return $environment;
79 }
80}
An exception for terminatinating execution or to throw for unit testing.
Class ilCtrlStructureReader.
__construct(\ilCtrlStructureReader $ctrl_reader, bool $populate_before=true)
getPreconditions(Setup\Environment $environment)
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
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.
Definition: Objective.php:15
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68