Composer::deleteRecursive
protected static function Composer::deleteRecursive
protected static Composer::deleteRecursive($path)
Helper method to remove directories and the files they contain.
Parameters
string $path: The directory or file to remove. It must exist.
Return value
bool TRUE on success or FALSE on failure.
File
- core/lib/Drupal/Core/Composer/Composer.php, line 231
Class
- Composer
- Provides static functions for composer script events.
Namespace
Drupal\Core\ComposerCode
protected static function deleteRecursive($path) { if (is_file($path) || is_link($path)) { return unlink($path); } $success = TRUE; $dir = dir($path); while (($entry = $dir->read()) !== FALSE) { if ($entry == '.' || $entry == '..') { continue; } $entry_path = $path . '/' . $entry; $success = static::deleteRecursive($entry_path) && $success; } $dir->close(); return rmdir($path) && $success; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Composer!Composer.php/function/Composer::deleteRecursive/8.1.x