(string $metaRoot, string $folder)
| 56 | } |
| 57 | |
| 58 | public static function deleteSubtree(string $metaRoot, string $folder): void |
| 59 | { |
| 60 | $metaRoot = rtrim($metaRoot, '/\\') . DIRECTORY_SEPARATOR; |
| 61 | $folder = self::folderKey($folder); |
| 62 | if ($folder === 'root') { |
| 63 | return; |
| 64 | } |
| 65 | |
| 66 | foreach (self::newSubtreeGlobPatterns($metaRoot, $folder) as $pattern) { |
| 67 | foreach (glob($pattern) ?: [] as $path) { |
| 68 | if (is_file($path)) { |
| 69 | @unlink($path); |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | if (!self::isCollisionSensitive($folder)) { |
| 75 | $legacyPrefix = str_replace(['/', '\\', ' '], '-', $folder); |
| 76 | foreach (glob($metaRoot . $legacyPrefix . '*_metadata.json') ?: [] as $path) { |
| 77 | if (is_file($path)) { |
| 78 | @unlink($path); |
| 79 | } |
| 80 | } |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | public static function renameSubtree(string $metaRoot, string $oldFolder, string $newFolder): void |
| 85 | { |
no test coverage detected