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

Method rrmdir

src/FileRise/Domain/UploadModel.php:1497–1514  ·  view source on GitHub ↗

* Recursively removes a directory and its contents. * * @param string $dir The directory to remove. * @return void */

(string $dir)

Source from the content-addressed store, hash-verified

1495 * @return void
1496 */
1497 private static function rrmdir(string $dir): void
1498 {
1499 if (!is_dir($dir)) {
1500 return;
1501 }
1502 $iterator = new RecursiveIteratorIterator(
1503 new RecursiveDirectoryIterator($dir, FilesystemIterator::SKIP_DOTS),
1504 RecursiveIteratorIterator::CHILD_FIRST
1505 );
1506 foreach ($iterator as $file) {
1507 if ($file->isDir()) {
1508 rmdir($file->getRealPath());
1509 } else {
1510 unlink($file->getRealPath());
1511 }
1512 }
1513 rmdir($dir);
1514 }
1515
1516 /**
1517 * Removes the temporary chunk directory for resumable uploads.

Callers 3

handleUploadMethod · 0.95
removeChunksMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected