function Filesystem::rmdir
Same name in this branch
- 11.1.x core/lib/Drupal/Core/File/FileSystem.php \Drupal\Core\File\FileSystem::rmdir()
Attempts to rmdir a file and in case of failure retries after 350ms on windows
Return value
bool
Throws
\RuntimeException
2 calls to Filesystem::rmdir()
- Filesystem::removeDirectoryPhp in vendor/
composer/ composer/ src/ Composer/ Util/ Filesystem.php - Recursively delete directory using PHP iterators.
- Filesystem::removeJunction in vendor/
composer/ composer/ src/ Composer/ Util/ Filesystem.php - Removes a Windows NTFS junction.
File
-
vendor/
composer/ composer/ src/ Composer/ Util/ Filesystem.php, line 316
Class
- Filesystem
- @author Jordi Boggiano <j.boggiano@seld.be> @author Johannes M. Schmitt <schmittjoh@gmail.com>
Namespace
Composer\UtilCode
public function rmdir(string $path) {
$deleted = @rmdir($path);
if (!$deleted) {
// retry after a bit on windows since it tends to be touchy with mass removals
if (Platform::isWindows()) {
usleep(350000);
$deleted = @rmdir($path);
}
if (!$deleted) {
$error = error_get_last();
$message = 'Could not delete ' . $path . ': ' . ($error['message'] ?? '');
if (Platform::isWindows()) {
$message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
}
throw new \RuntimeException($message);
}
}
return true;
}