ILIAS  release_8 Revision v8.24
class.ilLanguagesUpdatedObjective.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=1);
4
22use ILIAS\Setup;
23
25{
26 protected \ilSetupLanguage $il_setup_language;
27
28 public function __construct(
30 ) {
31 $this->il_setup_language = $il_setup_language;
32 }
33
37 public function getHash(): string
38 {
39 return hash("sha256", self::class);
40 }
41
45 protected function getInstalledLanguagesAsString(): string
46 {
47 return implode(", ", $this->il_setup_language->getInstalledLanguages());
48 }
49
53 public function getLabel(): string
54 {
55 return "Update languages " . $this->getInstalledLanguagesAsString();
56 }
57
61 public function isNotable(): bool
62 {
63 return true;
64 }
65
69 public function getPreconditions(Setup\Environment $environment): array
70 {
71 return [];
72 }
73
77 public function achieve(Setup\Environment $environment): Setup\Environment
78 {
79 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
80
81 // TODO: Remove this once ilSetupLanguage (or a successor) supports proper
83 $db_tmp = $GLOBALS["ilDB"];
84 $GLOBALS["ilDB"] = $db;
85
86 $this->il_setup_language->setDbHandler($db);
87 $this->il_setup_language->installLanguages(
88 $this->il_setup_language->getInstalledLanguages(),
89 $this->il_setup_language->getLocalLanguages()
90 );
91
92 $GLOBALS["ilDB"] = $db_tmp;
93
94 return $environment;
95 }
96
100 public function isApplicable(Setup\Environment $environment): bool
101 {
102 return true;
103 }
104}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
getPreconditions(Setup\Environment $environment)
@inheritDoc
__construct(\ilSetupLanguage $il_setup_language)
getInstalledLanguagesAsString()
Return installed languages as string.
achieve(Setup\Environment $environment)
@inheritDoc
isApplicable(Setup\Environment $environment)
@inheritDoc
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
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:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...