ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilFileSystemComponentDataDirectoryCreatedObjective Class Reference
+ Inheritance diagram for ilFileSystemComponentDataDirectoryCreatedObjective:
+ Collaboration diagram for ilFileSystemComponentDataDirectoryCreatedObjective:

Public Member Functions

 __construct (string $component_dir, int $base_location=self::DATADIR)
 
 getHash ()
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 

Data Fields

const DATADIR = 1
 
const WEBDIR = 2
 

Protected Member Functions

 buildPath (Setup\Environment $environment)
 

Protected Attributes

string $component_dir
 
int $base_location
 

Private Member Functions

 checkEnvironment (Setup\Environment $environment)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFileSystemComponentDataDirectoryCreatedObjective::__construct ( string  $component_dir,
int  $base_location = self::DATADIR 
)

Member Function Documentation

◆ achieve()

ilFileSystemComponentDataDirectoryCreatedObjective::achieve ( Setup\Environment  $environment)

Definition at line 83 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

References buildPath(), and checkEnvironment().

83  : Setup\Environment
84  {
85  if (!$this->checkEnvironment($environment)) {
86  throw new Setup\UnachievableException("Environment is not ready for this objective");
87  }
88  $this->path = $this->buildPath($environment);
89  return parent::achieve($environment);
90  }
+ Here is the call graph for this function:

◆ buildPath()

ilFileSystemComponentDataDirectoryCreatedObjective::buildPath ( Setup\Environment  $environment)
protected

Definition at line 45 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

References $client_id, $component_dir, $data_dir, and $ini.

Referenced by achieve(), and isApplicable().

45  : string
46  {
47  $ini = $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI);
48  $client_id = $environment->getResource(Setup\Environment::RESOURCE_CLIENT_ID);
49 
50  if ($this->base_location === self::DATADIR) {
51  $data_dir = $ini->readVariable('clients', 'datadir');
52  } elseif ($this->base_location === self::WEBDIR) {
53  $data_dir = dirname(__DIR__, 5) . "/public/data";
54  }
55  if (!isset($data_dir)) {
56  throw new LogicException('cannot determine base directory');
57  }
58 
59  $client_data_dir = $data_dir . '/' . $client_id;
60 
61  return $client_data_dir . '/' . $this->component_dir;
62  }
$client_id
Definition: ltiauth.php:67
$ini
Definition: raiseError.php:4
+ Here is the caller graph for this function:

◆ checkEnvironment()

ilFileSystemComponentDataDirectoryCreatedObjective::checkEnvironment ( Setup\Environment  $environment)
private

Definition at line 104 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

Referenced by achieve(), and isApplicable().

104  : bool
105  {
106  if (null === $environment->getResource(Setup\Environment::RESOURCE_ILIAS_INI)) {
107  return false;
108  }
109  if (null === $environment->getResource(Setup\Environment::RESOURCE_CLIENT_ID)) {
110  return false;
111  }
112  return true;
113  }
+ Here is the caller graph for this function:

◆ getHash()

ilFileSystemComponentDataDirectoryCreatedObjective::getHash ( )

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

40  : string
41  {
42  return hash("sha256", self::class . "::" . $this->component_dir . $this->base_location);
43  }

◆ getPreconditions()

ilFileSystemComponentDataDirectoryCreatedObjective::getPreconditions ( Setup\Environment  $environment)
Returns
[]|[]

Definition at line 67 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

67  : array
68  {
69  // case if it is a fresh ILIAS installation
70  if ($environment->hasConfigFor("filesystem")) {
71  $config = $environment->getConfigFor("filesystem");
72  return [
74  ];
75  }
76 
77  // case if ILIAS is already installed
78  return [
80  ];
81  }

◆ isApplicable()

ilFileSystemComponentDataDirectoryCreatedObjective::isApplicable ( Setup\Environment  $environment)

Definition at line 95 of file class.ilFileSystemComponentDataDirectoryCreatedObjective.php.

References buildPath(), and checkEnvironment().

95  : bool
96  {
97  if (!$this->checkEnvironment($environment)) {
98  return false;
99  }
100  $this->path = $this->buildPath($environment);
101  return parent::isApplicable($environment);
102  }
+ Here is the call graph for this function:

Field Documentation

◆ $base_location

int ilFileSystemComponentDataDirectoryCreatedObjective::$base_location
protected

◆ $component_dir

string ilFileSystemComponentDataDirectoryCreatedObjective::$component_dir
protected

◆ DATADIR

const ilFileSystemComponentDataDirectoryCreatedObjective::DATADIR = 1

◆ WEBDIR


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