ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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)
 

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

Implements ILIAS\Setup\Objective.

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

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

55  : Environment
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  }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
$client_id
Definition: ltiauth.php:66
hasConfigFor(string $component)
+ 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.

References $path.

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

◆ 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.

48  : array
49  {
50  return [
52  ];
53  }

◆ isApplicable()

ilFileSystemClientDirectoryRenamedObjective::isApplicable ( Environment  $environment)

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"

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