ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilDatabaseUpdatedObjective Class Reference
+ Inheritance diagram for ilDatabaseUpdatedObjective:
+ Collaboration diagram for ilDatabaseUpdatedObjective:

Public Member Functions

 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 

Detailed Description

Definition at line 24 of file class.ilDatabaseUpdatedObjective.php.

Member Function Documentation

◆ achieve()

ilDatabaseUpdatedObjective::achieve ( Setup\Environment  $environment)

Definition at line 54 of file class.ilDatabaseUpdatedObjective.php.

References $client_id, $DIC, $GLOBALS, $ini, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Setup\Environment\getResource(), and ILIAS\UI\examples\MessageBox\Info\info().

54  : Setup\Environment
55  {
56  $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
57  $io = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
58  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
59  $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
60  $client_id = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_ID);
61 
62  // ATTENTION: This is a total abomination. It only exists to allow the db-
63  // update to run. This is a memento to the fact, that dependency injection
64  // is something we want. Currently, every component could just service
65  // locate the whole world via the global $DIC.
67  $DIC = $GLOBALS["DIC"] ?? [];
68  $GLOBALS["DIC"] = new DI\Container();
69  $GLOBALS["DIC"]["ilDB"] = $db;
70  $GLOBALS["ilDB"] = $db;
71  $GLOBALS["DIC"]["ilBench"] = null;
72  $GLOBALS["DIC"]["ilLog"] = new class ($io) {
73  protected $io;
74  public function __construct($io)
75  {
76  $this->io = $io;
77  }
78 
79  public function write(): void
80  {
81  }
82 
83  public function info(): void
84  {
85  }
86 
87  public function warning($msg): void
88  {
89  $this->io->inform($msg);
90  }
91 
92  public function error($msg): void
93  {
94  throw new Setup\UnachievableException(
95  "Problem in DB-Update: $msg"
96  );
97  }
98  };
99  $GLOBALS["ilLog"] = $GLOBALS["DIC"]["ilLog"];
100  $GLOBALS["DIC"]["ilLoggerFactory"] = new class () {
101  public function getRootLogger(): object
102  {
103  return new class () {
104  public function write(): void
105  {
106  }
107  };
108  }
109  };
110  $GLOBALS["ilCtrlStructureReader"] = new class () {
111  public function getStructure(): void
112  {
113  }
114 
115  public function setIniFile(): void
116  {
117  }
118  };
119  if (!defined("CLIENT_DATA_DIR")) {
120  define("CLIENT_DATA_DIR", $ini->readVariable("clients", "datadir") . "/" . $client_id);
121  }
122  if (!defined("CLIENT_WEB_DIR")) {
123  define("CLIENT_WEB_DIR", dirname(__DIR__, 5) . "/public/data/" . $client_id);
124  }
125  if (!defined("ILIAS_ABSOLUTE_PATH")) {
126  define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 6));
127  }
128  if (!defined("ILIAS_LOG_ENABLED")) {
129  define("ILIAS_LOG_ENABLED", false);
130  }
131  if (!defined("ROOT_FOLDER_ID")) {
132  define("ROOT_FOLDER_ID", (int) $client_ini->readVariable("system", "ROOT_FOLDER_ID"));
133  }
134  if (!defined("ROLE_FOLDER_ID")) {
135  define("ROLE_FOLDER_ID", (int) $client_ini->readVariable("system", "ROLE_FOLDER_ID"));
136  }
137  if (!defined("SYSTEM_FOLDER_ID")) {
138  define("SYSTEM_FOLDER_ID", (int) $client_ini->readVariable("system", "SYSTEM_FOLDER_ID"));
139  }
140 
141  $db_update = new ilDBUpdate($db);
142  $db_update->applyCustomUpdates();
143 
144  $GLOBALS["DIC"] = $DIC;
145 
146  return $environment;
147  }
info()
description: > Example for rendering a info message box.
Definition: info.php:18
$GLOBALS["DIC"]
Definition: wac.php:30
global $DIC
Definition: shib_login.php:25
Database Update class.
__construct(Container $dic, ilPlugin $plugin)
$client_id
Definition: ltiauth.php:67
$ini
Definition: raiseError.php:4
+ Here is the call graph for this function:

◆ getHash()

ilDatabaseUpdatedObjective::getHash ( )

Definition at line 26 of file class.ilDatabaseUpdatedObjective.php.

26  : string
27  {
28  return hash("sha256", self::class);
29  }

◆ getLabel()

ilDatabaseUpdatedObjective::getLabel ( )

Definition at line 31 of file class.ilDatabaseUpdatedObjective.php.

31  : string
32  {
33  return "The database is updated.";
34  }

◆ getPreconditions()

ilDatabaseUpdatedObjective::getPreconditions ( Setup\Environment  $environment)
Returns
[]|[]|[]

Definition at line 44 of file class.ilDatabaseUpdatedObjective.php.

44  : array
45  {
46  $preconditions = [];
47  $preconditions[] = new Setup\Objective\ClientIdReadObjective();
48  $preconditions[] = new ilIniFilesPopulatedObjective();
49  $preconditions[] = new ilDatabaseInitializedObjective();
50 
51  return $preconditions;
52  }

◆ isApplicable()

ilDatabaseUpdatedObjective::isApplicable ( Setup\Environment  $environment)

Definition at line 152 of file class.ilDatabaseUpdatedObjective.php.

152  : bool
153  {
154  return true;
155  }

◆ isNotable()

ilDatabaseUpdatedObjective::isNotable ( )

Definition at line 36 of file class.ilDatabaseUpdatedObjective.php.

36  : bool
37  {
38  return true;
39  }

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