ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLanguagesUpdatedObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22
24{
25 protected \ilSetupLanguage $il_setup_language;
26
27 public function __construct(
29 ) {
30 $this->il_setup_language = $il_setup_language;
31 }
32
36 public function getHash(): string
37 {
38 return hash("sha256", self::class);
39 }
40
44 protected function getInstalledLanguagesAsString(): string
45 {
46 return implode(", ", $this->il_setup_language->getInstalledLanguages());
47 }
48
52 public function getLabel(): string
53 {
54 return "Update languages " . $this->getInstalledLanguagesAsString();
55 }
56
60 public function isNotable(): bool
61 {
62 return true;
63 }
64
68 public function getPreconditions(Setup\Environment $environment): array
69 {
70 return [];
71 }
72
76 public function achieve(Setup\Environment $environment): Setup\Environment
77 {
78 $db = $environment->getResource(Setup\Environment::RESOURCE_DATABASE);
79
80 // TODO: Remove this once ilSetupLanguage (or a successor) supports proper
82 $db_tmp = $GLOBALS["ilDB"];
83 $GLOBALS["ilDB"] = $db;
84
85 $this->il_setup_language->setDbHandler($db);
86 $this->il_setup_language->installLanguages(
87 $this->il_setup_language->getInstalledLanguages(),
88 $this->il_setup_language->getLocalLanguages()
89 );
90
91 $GLOBALS["ilDB"] = $db_tmp;
92
93 return $environment;
94 }
95
99 public function isApplicable(Setup\Environment $environment): bool
100 {
101 return true;
102 }
103}
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
language handling for setup
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...
$GLOBALS["DIC"]
Definition: wac.php:54