ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilFileSystemConfigNotChangedObjective.php
Go to the documentation of this file.
1 <?php
2 
19 use ILIAS\Setup;
20 
21 class ilFileSystemConfigNotChangedObjective implements Setup\Objective
22 {
23  protected \ilFileSystemSetupConfig $config;
24 
25  public function __construct(
27  ) {
28  $this->config = $config;
29  }
30 
31  public function getHash(): string
32  {
33  return hash("sha256", self::class);
34  }
35 
36  public function getLabel(): string
37  {
38  return "Config for Filesystems did not change.";
39  }
40 
41  public function isNotable(): bool
42  {
43  return false;
44  }
45 
49  public function getPreconditions(Setup\Environment $environment): array
50  {
51  return [
54  ];
55  }
56 
57  public function achieve(Setup\Environment $environment): Setup\Environment
58  {
59  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
60 
61  $current = $ini->readVariable("clients", "datadir");
62  $new = $this->config->getDataDir();
63  if ($current !== $new) {
64  throw new Setup\UnachievableException(
65  "You seem to try to move the ILIAS data-directory from '$current' " .
66  "to '$new', the client.ini.php contains a different path then the " .
67  "config you are using. This is not supported by the setup."
68  );
69  }
70 
71  return $environment;
72  }
73 
77  public function isApplicable(Setup\Environment $environment): bool
78  {
79  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
80 
81  return $ini->readVariable("clients", "datadir") !== $this->config->getDataDir();
82  }
83 }
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:27
$ini
Definition: raiseError.php:4