ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilIniFilesPopulatedObjective Class Reference
+ Inheritance diagram for ilIniFilesPopulatedObjective:
+ Collaboration diagram for ilIniFilesPopulatedObjective:

Public Member Functions

 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 @inheritDoc More...
 

Protected Member Functions

 getClientDir (string $client_id)
 
 getClientIniPath (string $client_id)
 
 getILIASIniPath ()
 

Detailed Description

Definition at line 23 of file class.ilIniFilesPopulatedObjective.php.

Member Function Documentation

◆ achieve()

ilIniFilesPopulatedObjective::achieve ( Setup\Environment  $environment)

Definition at line 61 of file class.ilIniFilesPopulatedObjective.php.

61 : Setup\Environment
62 {
63 $client_id = (string) $environment->getResource(Setup\Environment::RESOURCE_CLIENT_ID);
64
65 $path = $this->getILIASIniPath();
66 if (!file_exists($path)) {
67 $ini = new ilIniFile($path);
68 $ini->GROUPS = parse_ini_file(__DIR__ . "/../ilias.master.ini.php", true);
69 $ini->write();
70 $environment = $environment
71 ->withResource(Setup\Environment::RESOURCE_ILIAS_INI, $ini);
72 }
73
75 if (!file_exists($path)) {
76 $client_ini = new ilIniFile($path);
77 $client_ini->GROUPS = parse_ini_file(__DIR__ . "/../client.master.ini.php", true);
78 $client_ini->write();
79 $environment = $environment
80 ->withResource(Setup\Environment::RESOURCE_CLIENT_INI, $client_ini);
81 }
82
83 return $environment;
84 }
INIFile Parser Early access in init proceess! Avoid further dependencies like logging or other servic...
$client_id
Definition: ltiauth.php:67
$path
Definition: ltiservices.php:30
$ini
Definition: raiseError.php:20

References $client_id, $ini, $path, getClientIniPath(), and getILIASIniPath().

+ Here is the call graph for this function:

◆ getClientDir()

ilIniFilesPopulatedObjective::getClientDir ( string  $client_id)
protected

Definition at line 97 of file class.ilIniFilesPopulatedObjective.php.

97 : string
98 {
99 return dirname(__DIR__, 4) . "/public/data/" . $client_id;
100 }

References $client_id.

Referenced by getClientIniPath(), and getPreconditions().

+ Here is the caller graph for this function:

◆ getClientIniPath()

ilIniFilesPopulatedObjective::getClientIniPath ( string  $client_id)
protected

Definition at line 102 of file class.ilIniFilesPopulatedObjective.php.

102 : string
103 {
104 return $this->getClientDir($client_id) . "/client.ini.php";
105 }

References getClientDir().

Referenced by achieve(), and isApplicable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getHash()

ilIniFilesPopulatedObjective::getHash ( )

Definition at line 25 of file class.ilIniFilesPopulatedObjective.php.

25 : string
26 {
27 return hash("sha256", self::class);
28 }

◆ getILIASIniPath()

ilIniFilesPopulatedObjective::getILIASIniPath ( )
protected

Definition at line 107 of file class.ilIniFilesPopulatedObjective.php.

107 : string
108 {
109 return dirname(__DIR__, 4) . "/ilias.ini.php";
110 }

Referenced by achieve(), and isApplicable().

+ Here is the caller graph for this function:

◆ getLabel()

ilIniFilesPopulatedObjective::getLabel ( )

Definition at line 30 of file class.ilIniFilesPopulatedObjective.php.

30 : string
31 {
32 return "The ilias.ini.php and client.ini.php are populated.";
33 }

◆ getPreconditions()

ilIniFilesPopulatedObjective::getPreconditions ( Setup\Environment  $environment)

Definition at line 40 of file class.ilIniFilesPopulatedObjective.php.

40 : array
41 {
42 $client_id = (string) $environment->getResource(Setup\Environment::RESOURCE_CLIENT_ID);
43 if ($client_id === null) {
44 throw new \LogicException(
45 "Expected a client_id in the environment."
46 );
47 }
48 $client_dir = $this->getClientDir($client_id);
49
50 // TODO: This shows an unfortunate connection between the webdir and the
51 // client.ini.php. Why does the client.ini reside in the webdir? If we
52 // remove the client-feature, the client-ini will go away...
53 return [
54 new Setup\Objective\DirectoryCreatedObjective(dirname(__DIR__, 4) . "/public/data"),
55 new Setup\Objective\DirectoryCreatedObjective($client_dir),
56 new Setup\Condition\CanCreateFilesInDirectoryCondition($client_dir),
57 new Setup\Condition\CanCreateFilesInDirectoryCondition(dirname(__DIR__, 4))
58 ];
59 }

References $client_id, and getClientDir().

+ Here is the call graph for this function:

◆ isApplicable()

ilIniFilesPopulatedObjective::isApplicable ( Setup\Environment  $environment)

@inheritDoc

Definition at line 89 of file class.ilIniFilesPopulatedObjective.php.

89 : bool
90 {
91 $client_id = (string) $environment->getResource(Setup\Environment::RESOURCE_CLIENT_ID);
92
93 return !file_exists($this->getILIASIniPath())
94 || !file_exists($this->getClientIniPath($client_id));
95 }

References $client_id, getClientIniPath(), and getILIASIniPath().

+ Here is the call graph for this function:

◆ isNotable()

ilIniFilesPopulatedObjective::isNotable ( )

Definition at line 35 of file class.ilIniFilesPopulatedObjective.php.

35 : bool
36 {
37 return true;
38 }

The documentation for this class was generated from the following file: