MCPcopy Create free account
hub / github.com/error311/FileRise / copyFolderAcrossSources

Method copyFolderAcrossSources

src/FileRise/Domain/FolderModel.php:1450–1477  ·  view source on GitHub ↗
(
        string $sourceId,
        string $destinationId,
        string $sourceFolder,
        string $targetFolder
    )

Source from the content-addressed store, hash-verified

1448 }
1449
1450 public static function copyFolderAcrossSources(
1451 string $sourceId,
1452 string $destinationId,
1453 string $sourceFolder,
1454 string $targetFolder
1455 ): array {
1456 $srcStorage = StorageRegistry::getAdapter($sourceId);
1457 $dstStorage = StorageRegistry::getAdapter($destinationId);
1458
1459 $srcRoot = class_exists('SourceContext')
1460 ? SourceContext::uploadRootForId($sourceId)
1461 : rtrim((string)UPLOAD_DIR, "/\\") . DIRECTORY_SEPARATOR;
1462 $dstRoot = class_exists('SourceContext')
1463 ? SourceContext::uploadRootForId($destinationId)
1464 : rtrim((string)UPLOAD_DIR, "/\\") . DIRECTORY_SEPARATOR;
1465
1466 return self::copyFolderTreeInternal(
1467 $srcStorage,
1468 $dstStorage,
1469 $srcRoot,
1470 $dstRoot,
1471 $sourceFolder,
1472 $targetFolder,
1473 static function (string $srcKey, string $dstKey, array $files) use ($sourceId, $destinationId): array {
1474 return FileModel::copyFilesAcrossSources($sourceId, $destinationId, $srcKey, $dstKey, $files);
1475 }
1476 );
1477 }
1478
1479 public static function moveFolderAcrossSources(
1480 string $sourceId,

Callers 3

moveFolderMethod · 0.80

Calls 4

getAdapterMethod · 0.80
uploadRootForIdMethod · 0.80

Tested by

no test coverage detected