ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilUseRootConfirmed.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 root should be used to run the setup.";
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 $admin_interaction = $environment->getResource(Setup\Environment::RESOURCE_ADMIN_INTERACTION);
70
71 $message =
72 "You seem to be using root or your user just can't be determined. You should\n" .
73 "be running this setup with the same user the webserver uses. If this is not\n" .
74 "the case there might be problems accessing files via the web later...\n" .
75 "If you still proceed, carefully check file access rights in the data-directories\n" .
76 "after finishing the setup.\n";
77
78 if (!$admin_interaction->confirmOrDeny($message)) {
80 }
81
82 return $environment;
83 }
84
88 public function isApplicable(Setup\Environment $environment): bool
89 {
90 if (function_exists("posix_geteuid") && posix_geteuid() != 0) {
91 return false;
92 }
93
94 return true;
95 }
96}
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:28
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:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$message
Definition: xapiexit.php:31