ILIAS  release_7 Revision v7.30-3-g800a261c036
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 $admin_interaction = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
54
55 $message =
56 "You seem to be using root or your user just can't be determined. You should\n" .
57 "be running this setup with the same user the webserver uses. If this is not\n" .
58 "the case there might be problems accessing files via the web later...\n".
59 "If you still proceed, carefully check file access rights in the data-directories\n".
60 "after finishing the setup.\n";
61
62 if (!$admin_interaction->confirmOrDeny($message)) {
64 }
65
66 return $environment;
67 }
68
72 public function isApplicable(Setup\Environment $environment) : bool
73 {
74 if (function_exists("posix_geteuid") && posix_geteuid() != 0) {
75 return false;
76 }
77
78 return true;
79 }
80}
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)
isApplicable(Setup\Environment $environment)
@inheritDoc
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$message
Definition: xapiexit.php:14