ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilUseRootConfirmed.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
6
12{
16 public function getHash() : string
17 {
18 return hash(
19 "sha256",
20 get_class($this)
21 );
22 }
23
27 public function getLabel() : string
28 {
29 return "Confirm that root should be used to run the setup.";
30 }
31
35 public function isNotable() : bool
36 {
37 return false;
38 }
39
43 public function getPreconditions(Setup\Environment $environment) : array
44 {
45 return [];
46 }
47
51 public function achieve(Setup\Environment $environment) : Setup\Environment
52 {
53 if (function_exists("posix_geteuid") && posix_geteuid() != 0) {
54 return $environment;
55 }
56
57 $admin_interaction = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
58
59 $message =
60 "You seem to be using root or your user just can't be determined. You should\n" .
61 "be running this setup with the same user the webserver uses. If this is not\n" .
62 "the case there might be problems accessing files via the web later...\n";
63
64 if (!$admin_interaction->confirmOrDeny($message)) {
66 }
67
68 return $environment;
69 }
70}
An exception for terminatinating execution or to throw for unit testing.
Signals that a necessary confirmation from the admin is missing.
The user seems to use root or we cannot determine which user he uses.
getPreconditions(Setup\Environment $environment)
achieve(Setup\Environment $environment)
An environment holds resources to be used in the setup process.
Definition: Environment.php:12
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An objective is a desired state of the system that is supposed to be created by the setup.
Definition: Objective.php:15
$message
Definition: xapiexit.php:14