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

Public Member Functions

 __construct (protected string $path)
 
 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)
 @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...
 

Data Fields

const DEFAULT_CLIENT_ID = "default"
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFileSystemClientDirectoryRenamedObjective::__construct ( protected string  $path)

Definition at line 29 of file class.ilFileSystemClientDirectoryRenamedObjective.php.

30 {
31 }

Member Function Documentation

◆ achieve()

ilFileSystemClientDirectoryRenamedObjective::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 55 of file class.ilFileSystemClientDirectoryRenamedObjective.php.

56 {
57 $client_id = $environment->getResource(Environment::RESOURCE_CLIENT_ID);
58
59 $old_name = $this->path . DIRECTORY_SEPARATOR . $client_id;
60 $new_name = $this->path . DIRECTORY_SEPARATOR . self::DEFAULT_CLIENT_ID;
61
62 if ($environment->hasConfigFor(InstallCommand::IMPORT)) {
63 $old_name = $this->path . DIRECTORY_SEPARATOR . self::DEFAULT_CLIENT_ID;
64 $new_name = $this->path . DIRECTORY_SEPARATOR . $client_id;
65 }
66
67 rename($old_name, $new_name);
68
69 return $environment;
70 }
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
hasConfigFor(string $component)
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
$client_id
Definition: ltiauth.php:67

References $client_id, DEFAULT_CLIENT_ID, ILIAS\Setup\Environment\getResource(), and ILIAS\Setup\Environment\hasConfigFor().

+ Here is the call graph for this function:

◆ getHash()

ilFileSystemClientDirectoryRenamedObjective::getHash ( )

Get a hash for this objective.

The hash of two objectives must be the same, if they are the same objective, with the same config on the same environment, i.e. if the one is achieved the other is achieved as well because they are the same.

Implements ILIAS\Setup\Objective.

Definition at line 33 of file class.ilFileSystemClientDirectoryRenamedObjective.php.

33 : string
34 {
35 return hash("sha256", self::class) . $this->path;
36 }
$path
Definition: ltiservices.php:30

References $path.

◆ getLabel()

ilFileSystemClientDirectoryRenamedObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 38 of file class.ilFileSystemClientDirectoryRenamedObjective.php.

38 : string
39 {
40 return "Switch client names for export/import";
41 }

◆ getPreconditions()

ilFileSystemClientDirectoryRenamedObjective::getPreconditions ( Environment  $environment)

Objectives might depend on other objectives.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Objective.

Definition at line 48 of file class.ilFileSystemClientDirectoryRenamedObjective.php.

◆ isApplicable()

ilFileSystemClientDirectoryRenamedObjective::isApplicable ( Environment  $environment)

@inheritDoc

Implements ILIAS\Setup\Objective.

Definition at line 75 of file class.ilFileSystemClientDirectoryRenamedObjective.php.

75 : bool
76 {
77 return true;
78 }

◆ isNotable()

ilFileSystemClientDirectoryRenamedObjective::isNotable ( )

Get to know if this is an interesting objective for a human.

Implements ILIAS\Setup\Objective.

Definition at line 43 of file class.ilFileSystemClientDirectoryRenamedObjective.php.

43 : bool
44 {
45 return true;
46 }

Field Documentation

◆ DEFAULT_CLIENT_ID

const ilFileSystemClientDirectoryRenamedObjective::DEFAULT_CLIENT_ID = "default"

Definition at line 27 of file class.ilFileSystemClientDirectoryRenamedObjective.php.

Referenced by achieve().


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