ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 

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.

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

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  }
$path
Definition: ltiservices.php:32
$client_id
Definition: ltiauth.php:68
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$ini
Definition: raiseError.php:4
+ Here is the call graph for this function:

◆ getClientDir()

ilIniFilesPopulatedObjective::getClientDir ( string  $client_id)
protected

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

References $client_id.

Referenced by getClientIniPath(), and getPreconditions().

97  : string
98  {
99  return dirname(__DIR__, 2) . "/data/" . $client_id;
100  }
$client_id
Definition: ltiauth.php:68
+ Here is the caller graph for this function:

◆ getClientIniPath()

ilIniFilesPopulatedObjective::getClientIniPath ( string  $client_id)
protected

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

References getClientDir().

Referenced by achieve(), and isApplicable().

102  : string
103  {
104  return $this->getClientDir($client_id) . "/client.ini.php";
105  }
$client_id
Definition: ltiauth.php:68
+ 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.

Referenced by achieve(), and isApplicable().

107  : string
108  {
109  return dirname(__DIR__, 2) . "/ilias.ini.php";
110  }
+ 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.

References $client_id, and getClientDir().

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__, 2) . "/data"),
55  new Setup\Objective\DirectoryCreatedObjective($client_dir),
56  new Setup\Condition\CanCreateFilesInDirectoryCondition($client_dir),
57  new Setup\Condition\CanCreateFilesInDirectoryCondition(dirname(__DIR__, 2))
58  ];
59  }
$client_id
Definition: ltiauth.php:68
+ Here is the call graph for this function:

◆ isApplicable()

ilIniFilesPopulatedObjective::isApplicable ( Setup\Environment  $environment)

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

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

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  }
$client_id
Definition: ltiauth.php:68
+ 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: