ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilOverwritesExistingInstallationConfirmed.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
21use ILIAS\Setup;
22
28{
32 public function getHash(): string
33 {
34 return hash(
35 "sha256",
36 get_class($this)
37 );
38 }
39
43 public function getLabel(): string
44 {
45 return "Confirm that an existing installation should be overwritten.";
46 }
47
51 public function isNotable(): bool
52 {
53 return false;
54 }
55
59 public function getPreconditions(Setup\Environment $environment): array
60 {
61 return [];
62 }
63
67 public function achieve(Setup\Environment $environment): Setup\Environment
68 {
69 if (!$this->iniExists() && !$this->clientIniExists()) {
70 return $environment;
71 }
72
73 $admin_interaction = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
74
75 $message =
76 "An installation already seems to exist in this location. Using this command\n" .
77 "might change your installation in unexpected ways. Also, the command might not\n" .
78 "work as expected. Are you sure that you want to proceed anyway?";
79
80 if (!$admin_interaction->confirmOrDeny($message)) {
82 }
83
84 return $environment;
85 }
86
90 public function isApplicable(Setup\Environment $environment): bool
91 {
92 return $this->iniExists() || $this->clientIniExists();
93 }
94
95 public function iniExists(): bool
96 {
97 return file_exists(dirname(__DIR__, 4) . "/ilias.ini.php");
98 }
99
100 public function clientIniExists(): bool
101 {
102 return file_exists($this->getClientDir() . "/client.ini.php");
103 }
104
105 protected function getClientDir(): string
106 {
107 return dirname(__DIR__, 4) . "/public/data/" . ((string) $this->config->getClientId());
108 }
109}
Signals that a necessary confirmation from the admin is missing.
There seems to already exist an ILIAS installation, an interaction with it should be confirmed.
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...
$message
Definition: xapiexit.php:31