ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilStorageContainersExistingObjective Class Reference

Class ilStorageContainersExistingObjective. More...

+ Inheritance diagram for ilStorageContainersExistingObjective:
+ Collaboration diagram for ilStorageContainersExistingObjective:

Public Member Functions

 __construct (?array $storage_handler_ids=null)
 
 getPreconditions (Environment $environment)
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 @inheritDoc More...
 
- Public Member Functions inherited from ILIAS\Setup\Objective\DirectoryCreatedObjective
 __construct (string $path, int $permissions=self::DEFAULT_DIRECTORY_PERMISSIONS)
 
 getHash ()
 Uses hashed Path. More...
 
 getLabel ()
 Defaults to "Build $this->getArtifactPath()". More...
 
 isNotable ()
 Defaults to 'true'. More...
 
 getPreconditions (Setup\Environment $environment)
 @inheritdocs More...
 
 achieve (Setup\Environment $environment)
 @inheritdocs More...
 
 isApplicable (Setup\Environment $environment)
 @inheritDoc More...
 
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 

Protected Member Functions

 buildStorageBasePath (Environment $environment)
 

Protected Attributes

string $base_dir = StorageHandlerFactory::BASE_DIRECTORY
 
array $storage_handler_ids
 
- Protected Attributes inherited from ILIAS\Setup\Objective\DirectoryCreatedObjective
string $path
 
int $permissions
 

Additional Inherited Members

- Data Fields inherited from ILIAS\Setup\Objective\DirectoryCreatedObjective
const DEFAULT_DIRECTORY_PERMISSIONS = 0755
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilStorageContainersExistingObjective::__construct ( ?array  $storage_handler_ids = null)

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

41 {
42 parent::__construct(StorageHandlerFactory::BASE_DIRECTORY);
43 $this->storage_handler_ids = $storage_handler_ids ?? $this->storage_handler_ids;
44 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $storage_handler_ids, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ achieve()

ilStorageContainersExistingObjective::achieve ( Environment  $environment)

Objectives can be achieved.

They might add resources to the environment when they have been achieved.

This method needs to be idempotent for a given environment. That means: if this is executed a second time, nothing new should happen. Or the other way round: if the environment already looks like desired, the objective should not take any further actions when this is called.

Exceptions

LogicException if there are unfullfilled preconditions.

Exceptions

RuntimeException if there are missing resources.

Implements ILIAS\Setup\Objective.

Definition at line 77 of file class.ilStorageContainersExistingObjective.php.

78 {
79 $base_path = $this->buildStorageBasePath($environment);
80 $this->path = $base_path;
81 $environment = parent::achieve($environment);
82
83 foreach ($this->storage_handler_ids as $storage_handler_id) {
84 $this->path = $base_path . '/' . $storage_handler_id;
85 $environment = parent::achieve($environment);
86 }
87 return $environment;
88 }
An environment holds resources to be used in the setup process.
Definition: Environment.php:28

References buildStorageBasePath().

+ Here is the call graph for this function:

◆ buildStorageBasePath()

ilStorageContainersExistingObjective::buildStorageBasePath ( Environment  $environment)
protected

Definition at line 46 of file class.ilStorageContainersExistingObjective.php.

46 : string
47 {
48 $ini = $environment->getResource(Environment::RESOURCE_ILIAS_INI);
49 $client_id = $environment->getResource(Environment::RESOURCE_CLIENT_ID);
50 return $ini->readVariable(
51 'clients',
52 'datadir'
53 ) . '/' . $client_id . '/' . $this->base_dir;
54 }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
$client_id
Definition: ltiauth.php:67
$ini
Definition: raiseError.php:20

References $base_dir, $client_id, $ini, and ILIAS\Setup\Environment\getResource().

Referenced by achieve(), and isApplicable().

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

◆ getPreconditions()

ilStorageContainersExistingObjective::getPreconditions ( Environment  $environment)
Returns
\ilFileSystemDirectoriesCreatedObjective[]|\ilIniFilesLoadedObjective[]

Implements ILIAS\Setup\Objective.

Definition at line 60 of file class.ilStorageContainersExistingObjective.php.

60 : array
61 {
62 // case if it is a fresh ILIAS installation
63 if ($environment->hasConfigFor("filesystem")) {
64 $config = $environment->getConfigFor("filesystem");
65 return [
66 new \ilFileSystemDirectoriesCreatedObjective($config)
67 ];
68 }
69
70 // case if ILIAS is already installed
71 return [
72 new \ilIniFilesLoadedObjective()
73 ];
74 }
hasConfigFor(string $component)
getConfigFor(string $component)

References ILIAS\Setup\Environment\getConfigFor(), and ILIAS\Setup\Environment\hasConfigFor().

+ Here is the call graph for this function:

◆ isApplicable()

ilStorageContainersExistingObjective::isApplicable ( Environment  $environment)

@inheritDoc

Implements ILIAS\Setup\Objective.

Definition at line 94 of file class.ilStorageContainersExistingObjective.php.

94 : bool
95 {
96 $base_path = $this->buildStorageBasePath($environment);
97 $this->path = $base_path;
98 if (parent::isApplicable($environment)) {
99 return true;
100 }
101
102 foreach ($this->storage_handler_ids as $storage_handler_id) {
103 $this->path = $base_path . '/' . $storage_handler_id;
104 if (parent::isApplicable($environment)) {
105 return true;
106 }
107 }
108 return false;
109 }

References buildStorageBasePath().

+ Here is the call graph for this function:

Field Documentation

◆ $base_dir

string ilStorageContainersExistingObjective::$base_dir = StorageHandlerFactory::BASE_DIRECTORY
protected

Definition at line 31 of file class.ilStorageContainersExistingObjective.php.

Referenced by buildStorageBasePath().

◆ $storage_handler_ids

array ilStorageContainersExistingObjective::$storage_handler_ids
protected
Initial value:
= [
'fsv2'
]

Definition at line 36 of file class.ilStorageContainersExistingObjective.php.

Referenced by __construct().


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