ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDatabaseUpdatedObjective Class Reference
+ Inheritance diagram for ilDatabaseUpdatedObjective:
+ Collaboration diagram for ilDatabaseUpdatedObjective:

Public Member Functions

 __construct (\ilDatabaseSetupConfig $config, bool $populate_before=false)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
- Public Member Functions inherited from ilDatabaseObjective
 __construct (\ilDatabaseSetupConfig $config)
 

Protected Attributes

 $config
 
 $populate_before
 
- Protected Attributes inherited from ilDatabaseObjective
 $config
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilDatabaseUpdatedObjective::__construct ( \ilDatabaseSetupConfig  $config,
bool  $populate_before = false 
)

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

References $populate_before, and ILIAS\GlobalScreen\Provider\__construct().

Referenced by achieve().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Function Documentation

◆ achieve()

ilDatabaseUpdatedObjective::achieve ( Setup\Environment  $environment)

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

References $DIC, $GLOBALS, __construct(), ilDBUpdate\applyUpdate(), ILIAS\Setup\Environment\getResource(), and info().

61  : Setup\Environment
62  {
63  $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
64  $io = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
65  $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
66  $common_config = $environment->getConfigFor("common");
67  $filesystem_config = $environment->getConfigFor("filesystem");
68 
69  // ATTENTION: This is a total abomination. It only exists to allow the db-
70  // update to run. This is a memento to the fact, that dependency injection
71  // is something we want. Currently, every component could just service
72  // locate the whole world via the global $DIC.
73  $DIC = $GLOBALS["DIC"] ?? [];
74  $GLOBALS["DIC"] = new DI\Container();
75  $GLOBALS["DIC"]["ilDB"] = $db;
76  $GLOBALS["ilDB"] = $db;
77  $GLOBALS["DIC"]["ilBench"] = null;
78  $GLOBALS["DIC"]["ilLog"] = new class($io) {
79  public function __construct($io)
80  {
81  $this->io = $io;
82  }
83  public function write()
84  {
85  }
86  public function info()
87  {
88  }
89  public function warning($msg)
90  {
91  $this->io->inform($msg);
92  }
93  public function error($msg)
94  {
95  throw new Setup\UnachievableException(
96  "Problem in DB-Update: $msg"
97  );
98  }
99  };
100  $GLOBALS["ilLog"] = $GLOBALS["DIC"]["ilLog"];
101  $GLOBALS["DIC"]["ilLoggerFactory"] = new class() {
102  public function getRootLogger()
103  {
104  return new class() {
105  public function write()
106  {
107  }
108  };
109  }
110  };
111  $GLOBALS["ilCtrlStructureReader"] = new class() {
112  public function getStructure()
113  {
114  }
115  public function setIniFile()
116  {
117  }
118  };
119  define("CLIENT_DATA_DIR", $filesystem_config->getDataDir() . "/" . $common_config->getClientId());
120  define("CLIENT_WEB_DIR", $filesystem_config->getWebDir() . "/" . $common_config->getClientId());
121  if (!defined("ILIAS_ABSOLUTE_PATH")) {
122  define("ILIAS_ABSOLUTE_PATH", dirname(__FILE__, 5));
123  }
124  if (!defined("ILIAS_LOG_ENABLED")) {
125  define("ILIAS_LOG_ENABLED", false);
126  }
127  define("ROOT_FOLDER_ID", $client_ini->readVariable("system", "ROOT_FOLDER_ID"));
128  define("ROLE_FOLDER_ID", $client_ini->readVariable("system", "ROLE_FOLDER_ID"));
129  define("SYSTEM_FOLDER_ID", $client_ini->readVariable("system", "SYSTEM_FOLDER_ID"));
130 
131 
132  $db_update = new class($db, $client_ini) extends ilDBUpdate {
133  public function loadXMLInfo()
134  {
135  }
136  };
137 
138  $db_update->applyUpdate();
139  $db_update->applyHotfix();
140  $db_update->applyCustomUpdates();
141 
142  return $environment;
143  }
__construct(\ilDatabaseSetupConfig $config, bool $populate_before=false)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
Database Update class.
info()
Definition: info.php:2
$DIC
Definition: xapitoken.php:46
applyUpdate($a_break=0)
Apply update.
+ 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", implode("-", [
29  self::class,
30  $this->config->getHost(),
31  $this->config->getPort(),
32  $this->config->getDatabase()
33  ]));
34  }

◆ getLabel()

ilDatabaseUpdatedObjective::getLabel ( )

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

36  : string
37  {
38  return "The database is updated.";
39  }

◆ getPreconditions()

ilDatabaseUpdatedObjective::getPreconditions ( Setup\Environment  $environment)

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

46  : array
47  {
48  $common_config = $environment->getConfigFor("common");
49  if (!$this->populate_before) {
50  return [
51  new \ilIniFilesLoadedObjective($common_config),
52  new \ilDatabaseExistsObjective($this->config)
53  ];
54  }
55  return [
56  new \ilIniFilesPopulatedObjective($common_config),
57  new \ilDatabasePopulatedObjective($this->config)
58  ];
59  }

◆ isNotable()

ilDatabaseUpdatedObjective::isNotable ( )

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

41  : bool
42  {
43  return true;
44  }

Field Documentation

◆ $config

ilDatabaseUpdatedObjective::$config
protected

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

◆ $populate_before

ilDatabaseUpdatedObjective::$populate_before
protected

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

Referenced by __construct().


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