ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilFileSystemConfigNotChangedObjective.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 
6 use ILIAS\Setup;
7 
8 class ilFileSystemConfigNotChangedObjective implements Setup\Objective
9 {
13  protected $config;
14 
15  public function __construct(
17  ) {
18  $this->config = $config;
19  }
20 
21  public function getHash() : string
22  {
23  return hash("sha256", self::class);
24  }
25 
26  public function getLabel() : string
27  {
28  return "Config for Filesystems did not change.";
29  }
30 
31  public function isNotable() : bool
32  {
33  return false;
34  }
35 
36  public function getPreconditions(Setup\Environment $environment) : array
37  {
38  return [
41  ];
42  }
43 
44  public function achieve(Setup\Environment $environment) : Setup\Environment
45  {
46  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
47 
48  $current = $ini->readVariable("clients", "datadir");
49  $new = $this->config->getDataDir();
50  if ($current !== $new) {
51  throw new Setup\UnachievableException(
52  "You seem to try to move the ILIAS data-directory from '$current' " .
53  "to '$new', the client.ini.php contains a different path then the " .
54  "config you are using. This is not supported by the setup."
55  );
56  }
57 
58  return $environment;
59  }
60 
64  public function isApplicable(Setup\Environment $environment) : bool
65  {
66  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
67 
68  return $ini->readVariable("clients", "datadir") !== $this->config->getDataDir();
69  }
70 }
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:11
$ini
Definition: raiseError.php:4