19 declare(strict_types=1);
34 public function __construct(
protected string $source_folder,
protected string $target_folder,
protected bool $data_dir =
false,
protected bool $bare =
false)
43 return hash(
"sha256", self::class . $this->
getSourceName($this->source_folder) . $this->target_folder);
52 return "Copy directory from $source to $this->target_folder.";
78 $source = $this->source_folder;
84 $root =
$ini->readVariable(
"server",
"absolute_path");
86 if ($this->data_dir) {
87 $root =
$ini->readVariable(
"clients",
"datadir");
90 $source = $root . DIRECTORY_SEPARATOR . $this->source_folder;
93 if (file_exists($this->target_folder)) {
96 mkdir($this->target_folder, 0755);
101 RecursiveIteratorIterator::SELF_FIRST
105 foreach ($iterator as $item) {
106 if ($item->isDir()) {
107 mkdir($this->target_folder . DIRECTORY_SEPARATOR . $iterator->getSubPathname());
109 copy($item->getPathname(), $this->target_folder . DIRECTORY_SEPARATOR . $iterator->getSubPathname());
121 $source = $this->source_folder;
127 $root =
$ini->readVariable(
"server",
"absolute_path");
128 if ($this->data_dir) {
129 $root =
$ini->readVariable(
"clients",
"datadir");
132 $source = $root . DIRECTORY_SEPARATOR . $this->source_folder;
136 file_exists($source) &&
137 is_writable(pathinfo($this->target_folder, PATHINFO_DIRNAME))
145 RecursiveIteratorIterator::CHILD_FIRST
148 foreach ($files as $file_info) {
149 if ($file_info->isDir()) {
150 rmdir($file_info->getRealPath());
153 unlink($file_info->getRealPath());
159 if ($source !==
"") {
163 if ($this->data_dir) {
164 return "ilias data dir";
isNotable()
Get to know if this is an interesting objective for a human.
getPreconditions(Environment $environment)
Objectives might depend on other objectives.if the objective is not achievableObjective[] ...
An objective is a desired state of the system that is supposed to be created by the setup...
isApplicable(Environment $environment)
Get to know whether the objective is applicable.
deleteDirRecursive(string $path)
getHash()
Get a hash for this objective.The hash of two objectives must be the same, if they are the same objec...
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
getLabel()
Get a label that describes this objective.
achieve(Environment $environment)
Objectives can be achieved.
An environment holds resources to be used in the setup process.
getSourceName(string $source)
__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...