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

Public Member Functions

 __construct (protected string $source_folder, protected string $target_folder, protected bool $data_dir=false, protected bool $bare=false)
 Copies a directory from ILIAS root or from the outer ILIAS data directory depending on the flag $data_dir. More...
 
 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. 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.
Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]
More...
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 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

 deleteDirRecursive (string $path)
 
 getSourceName (string $source)
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFileSystemDirectoryCopiedRecursivelyObjective::__construct ( protected string  $source_folder,
protected string  $target_folder,
protected bool  $data_dir = false,
protected bool  $bare = false 
)

Copies a directory from ILIAS root or from the outer ILIAS data directory depending on the flag $data_dir.

With $source_folder you can select the directory to copy from selected root directory. Empty string for $source_folder means copy the whole root directory. $target_folder should always be the path wehre to copy into. Set the bare flag true to copy from $source_folder to $target_folder on whole filesystem.

Definition at line 34 of file class.ilFileSystemDirectoryCopiedRecursivelyObjective.php.

35 {
36 }

Member Function Documentation

◆ deleteDirRecursive()

ilFileSystemDirectoryCopiedRecursivelyObjective::deleteDirRecursive ( string  $path)
protected

Definition at line 141 of file class.ilFileSystemDirectoryCopiedRecursivelyObjective.php.

141 : void
142 {
143 $files = new RecursiveIteratorIterator(
144 new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
145 RecursiveIteratorIterator::CHILD_FIRST
146 );
147
148 foreach ($files as $file_info) {
149 if ($file_info->isDir()) {
150 rmdir($file_info->getRealPath());
151 continue;
152 }
153 unlink($file_info->getRealPath());
154 }
155 }
$path
Definition: ltiservices.php:30

References $path.

◆ getHash()

ilFileSystemDirectoryCopiedRecursivelyObjective::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 41 of file class.ilFileSystemDirectoryCopiedRecursivelyObjective.php.

41 : string
42 {
43 return hash("sha256", self::class . $this->getSourceName($this->source_folder) . $this->target_folder);
44 }

References getSourceName().

+ Here is the call graph for this function:

◆ getLabel()

ilFileSystemDirectoryCopiedRecursivelyObjective::getLabel ( )

Get a label that describes this objective.

Implements ILIAS\Setup\Objective.

Definition at line 49 of file class.ilFileSystemDirectoryCopiedRecursivelyObjective.php.

49 : string
50 {
51 $source = $this->getSourceName($this->source_folder);
52 return "Copy directory from $source to $this->target_folder.";
53 }

References getSourceName().

+ Here is the call graph for this function:

◆ getPreconditions()

ilFileSystemDirectoryCopiedRecursivelyObjective::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 66 of file class.ilFileSystemDirectoryCopiedRecursivelyObjective.php.

66 : array
67 {
68 return [
70 ];
71 }

◆ getSourceName()

ilFileSystemDirectoryCopiedRecursivelyObjective::getSourceName ( string  $source)
protected

Definition at line 157 of file class.ilFileSystemDirectoryCopiedRecursivelyObjective.php.

157 : string
158 {
159 if ($source !== "") {
160 return $source;
161 }
162
163 if ($this->data_dir) {
164 return "ilias data dir";
165 }
166
167 return "ilias root";
168 }

Referenced by getHash(), and getLabel().

+ Here is the caller graph for this function:

◆ isNotable()

ilFileSystemDirectoryCopiedRecursivelyObjective::isNotable ( )

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

Implements ILIAS\Setup\Objective.

Definition at line 58 of file class.ilFileSystemDirectoryCopiedRecursivelyObjective.php.

58 : bool
59 {
60 return true;
61 }

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