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\Composer
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 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 ; } |
Please login to continue.