19 declare(strict_types=1);
    46         string $filesystem_base_path
    56         $existing_handler = $this->handler_factory->getHandlerForResource($resource);
    57         $existing_path = $this->filesystem_base_path . 
'/' . $existing_handler->getFullContainerPath(
    61         $new_handler = $this->handler_factory->getHandlerForStorageId($to_handler_id);
    62         $destination_path = $this->filesystem_base_path . 
'/' . $new_handler->getFullContainerPath(
    66         if (!file_exists($existing_path)) {
    68             $this->resource_builder->remove($resource);
    72         if (!is_dir(dirname($destination_path)) && !mkdir(dirname($destination_path), 0777, 
true)) {
    75         if (file_exists($destination_path)) {
    79             $result = rename($existing_path, $destination_path);
    83             $this->database->manipulateF(
    84                 "UPDATE il_resource SET storage_id = %s WHERE rid = %s LIMIT 1",
    90             if ($this->clean_up) {
    91                 $existing_handler->cleanUpContainer($resource);
   102         foreach (glob($path . DIRECTORY_SEPARATOR . 
"*") as $file) {
   105         return $empty && rmdir($path);
   108     private function mergeDirectories(
string $path_to_source_dir, 
string $path_to_destination_dir): bool
   110         $dir = opendir($path_to_source_dir);
   112         while (($name = readdir($dir)) !== 
false) {
   113             if ($name === 
'.' || $name === 
'..') {
   117             $src_path = $path_to_source_dir . 
'/' . $name;
   118             $dest_path = $path_to_destination_dir . 
'/' . $name;
   120             if (is_dir($src_path)) {
   122                 if (!file_exists($dest_path)) {
   123                     mkdir($dest_path, 0777, 
true);
   126             } elseif (file_exists($dest_path)) {
   128                 rename($src_path, $dest_path);
   129             } elseif (!file_exists($dest_path)) {
   130                 rename($src_path, $dest_path);
 migrate(StorableResource $resource, string $to_handler_id)
 
Interface StorageResource. 
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
ResourceBuilder $resource_builder
 
string $filesystem_base_path
 
StorageHandlerFactory $handler_factory
 
__construct(StorageHandlerFactory $handler_factory, ResourceBuilder $resource_builder, \ilDBInterface $database, string $filesystem_base_path)
Migrator constructor. 
 
mergeDirectories(string $path_to_source_dir, string $path_to_destination_dir)
 
removeEmptySubFolders(string $path)
 
Class StorageHandlerFactory.