28 return hash(
"sha256", implode(
"-", [
30 $this->config->getHost(),
31 $this->config->getPort(),
32 $this->config->getDatabase()
38 return "The database is updated.";
48 $common_config = $environment->getConfigFor(
"common");
49 if (!$this->populate_before) {
51 new \ilIniFilesLoadedObjective($common_config),
52 new \ilDatabaseExistsObjective($this->config)
56 new \ilIniFilesPopulatedObjective($common_config),
57 new \ilDatabasePopulatedObjective($this->config)
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");
74 $GLOBALS[
"DIC"] =
new DI\Container();
78 $GLOBALS[
"DIC"][
"ilLog"] =
new class($io) {
83 public function write()
86 public function info()
89 public function warning($msg)
91 $this->io->inform($msg);
93 public function error($msg)
95 throw new Setup\UnachievableException(
96 "Problem in DB-Update: $msg" 101 $GLOBALS[
"DIC"][
"ilLoggerFactory"] =
new class() {
102 public function getRootLogger()
105 public function write()
111 $GLOBALS[
"ilCtrlStructureReader"] =
new class() {
112 public function getStructure()
115 public function setIniFile()
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));
124 if (!defined(
"ILIAS_LOG_ENABLED")) {
125 define(
"ILIAS_LOG_ENABLED",
false);
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"));
132 $db_update =
new class($db, $client_ini) extends
ilDBUpdate {
133 public function loadXMLInfo()
139 $db_update->applyHotfix();
140 $db_update->applyCustomUpdates();
getPreconditions(Setup\Environment $environment)
__construct(\ilDatabaseSetupConfig $config, bool $populate_before=false)
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An environment holds resources to be used in the setup process.
__construct(Container $dic, ilPlugin $plugin)
achieve(Setup\Environment $environment)
applyUpdate($a_break=0)
Apply update.