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

Public Member Functions

 __construct (string $source_folder, string $target_folder, bool $data_dir=false, bool $bare=false)
 Copies a directory from ILIAS root or from the outer ILIAS data directory depending on the flag $data_dir. More...
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 

Protected Member Functions

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

Protected Attributes

string $source_folder
 
string $target_folder
 
bool $data_dir
 
bool $bare
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilFileSystemDirectoryCopiedRecursivelyObjective::__construct ( string  $source_folder,
string  $target_folder,
bool  $data_dir = false,
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 38 of file class.ilFileSystemDirectoryCopiedRecursivelyObjective.php.

References $bare, $data_dir, $source_folder, and $target_folder.

Member Function Documentation

◆ deleteDirRecursive()

ilFileSystemDirectoryCopiedRecursivelyObjective::deleteDirRecursive ( string  $path)
protected

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

Referenced by getPreconditions().

153  : void
154  {
155  $files = new RecursiveIteratorIterator(
156  new RecursiveDirectoryIterator($path, FilesystemIterator::SKIP_DOTS),
157  RecursiveIteratorIterator::CHILD_FIRST
158  );
159 
160  foreach ($files as $file_info) {
161  if ($file_info->isDir()) {
162  rmdir($file_info->getRealPath());
163  continue;
164  }
165  unlink($file_info->getRealPath());
166  }
167  }
$path
Definition: ltiservices.php:30
+ Here is the caller graph for this function:

◆ getHash()

ilFileSystemDirectoryCopiedRecursivelyObjective::getHash ( )

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

References getSourceName().

53  : string
54  {
55  return hash("sha256", self::class . $this->getSourceName($this->source_folder) . $this->target_folder);
56  }
+ Here is the call graph for this function:

◆ getLabel()

ilFileSystemDirectoryCopiedRecursivelyObjective::getLabel ( )

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

References getSourceName().

61  : string
62  {
63  $source = $this->getSourceName($this->source_folder);
64  return "Copy directory from $source to $this->target_folder.";
65  }
+ Here is the call graph for this function:

◆ getPreconditions()

ilFileSystemDirectoryCopiedRecursivelyObjective::getPreconditions ( Setup\Environment  $environment)

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

References $ini, $source_folder, and deleteDirRecursive().

78  : array
79  {
80  return [
82  ];
83  }
+ Here is the call graph for this function:

◆ getSourceName()

ilFileSystemDirectoryCopiedRecursivelyObjective::getSourceName ( string  $source)
protected

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

Referenced by getHash(), and getLabel().

169  : string
170  {
171  if ($source !== "") {
172  return $source;
173  }
174 
175  if ($this->data_dir) {
176  return "ilias data dir";
177  }
178 
179  return "ilias root";
180  }
+ Here is the caller graph for this function:

◆ isNotable()

ilFileSystemDirectoryCopiedRecursivelyObjective::isNotable ( )

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

70  : bool
71  {
72  return true;
73  }

Field Documentation

◆ $bare

bool ilFileSystemDirectoryCopiedRecursivelyObjective::$bare
protected

◆ $data_dir

bool ilFileSystemDirectoryCopiedRecursivelyObjective::$data_dir
protected

◆ $source_folder

string ilFileSystemDirectoryCopiedRecursivelyObjective::$source_folder
protected

◆ $target_folder

string ilFileSystemDirectoryCopiedRecursivelyObjective::$target_folder
protected

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