ILIAS  release_8 Revision v8.24
class.ilFileSystemDirectoriesCreatedObjective.php
Go to the documentation of this file.
1<?php
2
4
5/******************************************************************************
6 *
7 * This file is part of ILIAS, a powerful learning management system.
8 *
9 * ILIAS is licensed with the GPL-3.0, you should have received a copy
10 * of said license along with the source code.
11 *
12 * If this is not the case or you just want to try ILIAS, you'll find
13 * us at:
14 * https://www.ilias.de
15 * https://github.com/ILIAS-eLearning
16 *
17 *****************************************************************************/
19{
20 protected \ilFileSystemSetupConfig $config;
21
22 public function __construct(
24 ) {
25 $this->config = $config;
26 }
27
28 public function getHash(): string
29 {
30 return hash("sha256", self::class);
31 }
32
33 public function getLabel(): string
34 {
35 return "ILIAS directories are created";
36 }
37
38 public function isNotable(): bool
39 {
40 return false;
41 }
42
46 public function getPreconditions(Setup\Environment $environment): array
47 {
48 $client_id = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_ID);
49 $data_dir = $this->config->getDataDir();
50 $web_dir = dirname(__DIR__, 4) . "/data";
51
52 $client_data_dir = $data_dir . '/' . $client_id;
53 $client_web_dir = $web_dir . '/' . $client_id;
54
55 return [
60 $client_web_dir
61 ),
63 $client_data_dir
64 )
65 ];
66 }
67
68 public function achieve(Setup\Environment $environment): Setup\Environment
69 {
70 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
71
72 $ini->setVariable("clients", "datadir", $this->config->getDataDir());
73
74 if (!$ini->write()) {
75 throw new Setup\UnachievableException("Could not write ilias.ini.php");
76 }
77
78 return $environment;
79 }
80
84 public function isApplicable(Setup\Environment $environment): bool
85 {
86 $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
87
88 return $ini->readVariable("clients", "datadir") !== $this->config->getDataDir();
89 }
90}
Signals that some goal won't be achievable by actions of the system ever.
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:31
$client_id
Definition: ltiauth.php:68
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:4