40     private const DIR_TO_ZIP = __DIR__ . 
'/dir_zip/testing_001';
    48     protected function setUp(): void
    50         if (file_exists($this->unzips_dir . self::ZIPPED_ZIP)) {
    51             unlink($this->unzips_dir . self::ZIPPED_ZIP);
    53         if (!defined(
'CLIENT_WEB_DIR')) {
    54             define(
'CLIENT_WEB_DIR', __DIR__);
    56         if (!defined(
'ILIAS_WEB_DIR')) {
    57             define(
'ILIAS_WEB_DIR', __DIR__);
    59         if (!defined(
'CLIENT_DATA_DIR')) {
    60             define(
'CLIENT_DATA_DIR', __DIR__);
    62         if (!defined(
'ILIAS_ABSOLUTE_PATH')) {
    63             define(
'ILIAS_ABSOLUTE_PATH', __DIR__);
    65         if (!defined(
'CLIENT_ID')) {
    66             define(
'CLIENT_ID', 
'client_id');
    72         if (!empty($this->extracting_dir) && file_exists($this->extracting_dir)) {
    75         if (!empty($this->zip_output_path) && file_exists($this->zip_output_path)) {
    76             unlink($this->zip_output_path);
    82         $legacy = 
new LegacyArchives();
    83         $directory_to_zip = self::DIR_TO_ZIP;
    84         $this->zip_output_path = $zip_output_path = $this->zips_dir . self::ZIPPED_ZIP;
    92         $this->assertTrue(file_exists($zip_output_path));
    95         $this->extracting_dir = $extracting_dir = $this->unzips_dir . 
'extracted';
   106             $this->
pathToArray($extracting_dir . 
'/' . basename($directory_to_zip))
   110         unlink($zip_output_path);
   111         $this->assertFalse(file_exists($zip_output_path));
   119         $ignore = [
'.', 
'..', 
'.DS_Store'];
   120         $files = new \RecursiveIteratorIterator(
   122             \RecursiveIteratorIterator::SELF_FIRST
   125             static function ($file) use ($path): 
string {
   126                 $real_path = $file->getRealPath();
   128                 return str_replace($path, 
'', $real_path);
   132                     iterator_to_array($files),
   133                     static function (\
SplFileInfo $file) use ($ignore): 
bool {
   134                         return !in_array($file->getFilename(), $ignore, 
true);
   143         $files = array_diff(scandir($path_to_directory), [
'.', 
'..']);
   144         foreach ($files as $file) {
   145             (is_dir(
"$path_to_directory/$file") && !is_link(
"$path_to_directory/$file")) ? $this->
recurseRmdir(
   146                 "$path_to_directory/$file"   147             ) : unlink(
"$path_to_directory/$file");
   149         return rmdir($path_to_directory);
 
pathToArray(string $path)
 
recurseRmdir(string $path_to_directory)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...