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

Method moveFolderAcrossSources

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

Source from the content-addressed store, hash-verified

1477 }
1478
1479 public static function moveFolderAcrossSources(
1480 string $sourceId,
1481 string $destinationId,
1482 string $sourceFolder,
1483 string $targetFolder
1484 ): array {
1485 $result = self::copyFolderAcrossSources($sourceId, $destinationId, $sourceFolder, $targetFolder);
1486 if (!empty($result['error'])) {
1487 return $result;
1488 }
1489
1490 if (class_exists('SourceContext') && SourceContext::sourcesEnabled()) {
1491 $prev = SourceContext::getActiveId();
1492 SourceContext::setActiveId($sourceId, false, true);
1493 try {
1494 $del = self::deleteFolderRecursiveAdmin($sourceFolder);
1495 } finally {
1496 SourceContext::setActiveId($prev, false);
1497 }
1498 } else {
1499 $del = self::deleteFolderRecursiveAdmin($sourceFolder);
1500 }
1501
1502 if (!empty($del['error'])) {
1503 return ['error' => 'Failed to remove source folder after copy: ' . $del['error'], 'target' => $targetFolder];
1504 }
1505
1506 return $result;
1507 }
1508
1509 /** Build metadata file path for a given (relative) folder. */
1510 private static function getMetadataFilePath(string $folder): string

Callers 3

moveFolderMethod · 0.80
opMoveFolderMethod · 0.80

Calls 5

getActiveIdMethod · 0.80
setActiveIdMethod · 0.80
sourcesEnabledMethod · 0.45

Tested by

no test coverage detected