(
string $sourceId,
string $destinationId,
string $sourceFolder,
string $targetFolder
)
| 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 |
no test coverage detected