19 declare(strict_types=1);
34 if (is_null($this->tmp_dir)) {
37 if(! array_key_exists(
'PWD',
$_SERVER)) {
38 throw new RuntimeException(
"Can't get to current directory. \nIf you ran the script using 'sudo', please try using 'sudo -s'");
48 return hash(
"sha256", self::class);
56 return "Export ILIAS to $this->cwd/" . self::FILENAME;
76 new Setup\ObjectiveCollection(
81 $this->tmp_dir .
"/public/data/" 87 $this->tmp_dir .
"/web_data/" 103 file_put_contents($this->tmp_dir .
"/meta.txt", implode(
"\n", $meta) .
"\n", FILE_APPEND);
108 $this->addFolderToZip($this->tmp_dir .
"/web_data", $this->tmp_dir .
"/web_data.zip");
109 $this->addFolderToZip($this->tmp_dir .
"/Customizing", $this->tmp_dir .
"/Customizing.zip");
110 $this->addFolderToZip($this->tmp_dir .
"/public/data", $this->tmp_dir .
"/data.zip");
111 $this->addFolderToZip($this->tmp_dir .
"/dump", $this->tmp_dir .
"/dump.zip");
118 $this->addFolderToZip($this->tmp_dir, $this->cwd .
"/" . self::FILENAME);
130 return is_writable($this->cwd);
133 protected function addFolderToZip($source, $destination, $flags = ZIPARCHIVE::CREATE | ZIPARCHIVE::OVERWRITE):
bool 135 if (!file_exists($source)) {
140 if (!$zip->open($destination, $flags)) {
147 RecursiveIteratorIterator::SELF_FIRST
150 $sourceWithSeparator = $source . DIRECTORY_SEPARATOR;
153 foreach ($files as $file) {
154 if ($file->isDir()) {
155 $zip->addEmptyDir(str_replace($sourceWithSeparator,
'', $file . DIRECTORY_SEPARATOR));
157 if ($file->isFile()) {
158 $zip->addFile($file->getPathname(), str_replace($sourceWithSeparator,
'', $file->getPathname()));
162 return $zip->close();
167 if (is_file($path)) {
174 RecursiveIteratorIterator::CHILD_FIRST
177 foreach ($files as $file_info) {
178 if ($file_info->isDir()) {
179 rmdir($file_info->getRealPath());
182 unlink($file_info->getRealPath());
190 $path = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . mt_rand() . microtime(
true);
__construct(Setup\Config $config)
getPreconditions(Setup\Environment $environment)
isApplicable(Setup\Environment $environment)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
A wrapper around an objective that adds some preconditions.
deleteDirRecursive(string $path)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
An environment holds resources to be used in the setup process.
__construct(Container $dic, ilPlugin $plugin)
getConfigFor(string $component)
A configuration for the setup.
achieve(Setup\Environment $environment)