ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMakeInstallationAccessibleObjective.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22
24{
25 public function getHash(): string
26 {
27 return hash("sha256", self::class);
28 }
29
30 public function getLabel(): string
31 {
32 return "The installation is accessible.";
33 }
34
35 public function isNotable(): bool
36 {
37 return true;
38 }
39
40 public function getPreconditions(Setup\Environment $environment): array
41 {
42 $db_config = $environment->getConfigFor("database");
43 return [
44 new \ilIniFilesPopulatedObjective(),
45 new ilDatabasePopulatedObjective($db_config),
46 new \ilSettingsFactoryExistsObjective()
47 ];
48 }
49
50 public function achieve(Setup\Environment $environment): Setup\Environment
51 {
52 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
53 $settings = $factory->settingsFor("common");
54
55 $settings->set("setup_ok", "1");
56
57 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
58
59 $client_ini->setVariable("client", "access", '1');
60
61 if (!$client_ini->write()) {
62 throw new Setup\UnachievableException("Could not write client.ini.php");
63 }
64
65 return $environment;
66 }
67
71 public function isApplicable(Setup\Environment $environment): bool
72 {
73 $factory = $environment->getResource(Setup\Environment::RESOURCE_SETTINGS_FACTORY);
74 $settings = $factory->settingsFor("common");
75 $client_ini = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_INI);
76
77 return
78 $settings->get("setup_ok") != 1 ||
79 $client_ini->readVariable("client", "access") != true
80 ;
81 }
82}
Signals that some goal won't be achievable by actions of the system ever.
return true
isApplicable(Setup\Environment $environment)
@inheritDoc
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.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...