19declare(strict_types=1);
25use FilesystemIterator;
27use RecursiveIteratorIterator;
29use RecursiveDirectoryIterator;
42 return hash(
"sha256", self::class);
47 return "Unzip files from $this->zip_path into temporary directory";
66 $tmp_dir . DIRECTORY_SEPARATOR .
"web_data.zip" => $tmp_dir . DIRECTORY_SEPARATOR .
"web_data",
67 $tmp_dir . DIRECTORY_SEPARATOR .
"Customizing.zip" => $tmp_dir . DIRECTORY_SEPARATOR .
"Customizing",
68 $tmp_dir . DIRECTORY_SEPARATOR .
"data.zip" => $tmp_dir . DIRECTORY_SEPARATOR .
"data",
69 $tmp_dir . DIRECTORY_SEPARATOR .
"dump.zip" => $tmp_dir
74 foreach ($dirs as $source => $destination) {
75 if (!file_exists($source)) {
89 return file_exists($this->zip_path);
99 $files =
new RecursiveIteratorIterator(
100 new RecursiveDirectoryIterator(
$path, FilesystemIterator::SKIP_DOTS),
101 RecursiveIteratorIterator::CHILD_FIRST
104 foreach ($files as $file_info) {
105 if ($file_info->isDir()) {
106 rmdir($file_info->getRealPath());
109 unlink($file_info->getRealPath());
112 if ($delete_base_dir) {
117 protected function extractZip(
string $source,
string $destination): void
119 $zip =
new ZipArchive();
122 $zip->extractTo($destination);
123 }
catch (\Exception
$e) {
deleteRecursive(string $path, bool $delete_base_dir=false)
achieve(Environment $environment)
Objectives can be achieved.
isNotable()
Get to know if this is an interesting objective for a human.
getPreconditions(Environment $environment)
Objectives might depend on other objectives.
getHash()
Get a hash for this objective.
__construct(string $zip_path)
extractZip(string $source, string $destination)
getLabel()
Get a label that describes this objective.
isApplicable(Environment $environment)
Get to know whether the objective is applicable.
Signals that some goal won't be achievable by actions of the system ever.
An environment holds resources to be used in the setup process.
getConfigFor(string $component)
An objective is a desired state of the system that is supposed to be created by the setup.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...