ILIAS  release_8 Revision v8.23
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  public function __construct($io)
74  {
75  $this->io = $io;
76  }
77 
78  public function write(): void
79  {
80  }
81 
82  public function info(): void
83  {
84  }
85 
86  public function warning($msg): void
87  {
88  $this->io->inform($msg);
89  }
90 
91  public function error($msg): void
92  {
93  throw new Setup\UnachievableException(
94  "Problem in DB-Update: $msg"
95  );
96  }
97  };
98  $GLOBALS["ilLog"] = $GLOBALS["DIC"]["ilLog"];
99  $GLOBALS["DIC"]["ilLoggerFactory"] = new class () {
100  public function getRootLogger(): object
101  {
102  return new class () {
103  public function write(): void
104  {
105  }
106  };
107  }
108  };
109  $GLOBALS["ilCtrlStructureReader"] = new class () {
110  public function getStructure(): void
111  {
112  }
113 
114  public function setIniFile(): void
115  {
116  }
117  };
118  if (!defined("CLIENT_DATA_DIR")) {
119  define("CLIENT_DATA_DIR", $ini->readVariable("clients", "datadir") . "/" . $client_id);
120  }
121  if (!defined("CLIENT_WEB_DIR")) {
122  define("CLIENT_WEB_DIR", dirname(__DIR__, 4) . "/data/" . $client_id);
123  }
124  if (!defined("ILIAS_ABSOLUTE_PATH")) {
125  define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
126  }
127  if (!defined("ILIAS_LOG_ENABLED")) {
128  define("ILIAS_LOG_ENABLED", false);
129  }
130  if (!defined("ROOT_FOLDER_ID")) {
131  define("ROOT_FOLDER_ID", (int) $client_ini->readVariable("system", "ROOT_FOLDER_ID"));
132  }
133  if (!defined("ROLE_FOLDER_ID")) {
134  define("ROLE_FOLDER_ID", (int) $client_ini->readVariable("system", "ROLE_FOLDER_ID"));
135  }
136  if (!defined("SYSTEM_FOLDER_ID")) {
137  define("SYSTEM_FOLDER_ID", (int) $client_ini->readVariable("system", "SYSTEM_FOLDER_ID"));
138  }
139 
140  $db_update = new ilDBUpdate($db);
141 
142  $db_update->applyUpdate();
143  $db_update->applyHotfix();
144  $db_update->applyCustomUpdates();
145 
146  $GLOBALS["DIC"] = $DIC;
147 
148  return $environment;
149  }
global $DIC
Definition: feed.php:28
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
$client_id
Definition: ltiauth.php:68
$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 154 of file class.ilDatabaseUpdatedObjective.php.

154  : bool
155  {
156  return true;
157  }

◆ 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: