You are here

function _less_recursive_delete in Less CSS Preprocessor 6.2

Recursively delete a path.

Lifted from imagecache, with thanks to dopry/drewish.

2 calls to _less_recursive_delete()
less_cron in ./less.module
Implements hook_cron().
_flush_less in ./less.admin.inc

File

./less.module, line 158
Handles compiling of .less files.

Code

function _less_recursive_delete($path) {
  if (is_file($path) || is_link($path)) {
    unlink($path);
  }
  elseif (is_dir($path)) {
    $d = dir($path);
    while (($entry = $d
      ->read()) !== FALSE) {
      if ($entry == '.' || $entry == '..') {
        continue;
      }
      $entry_path = $path . '/' . $entry;
      _less_recursive_delete($entry_path);
    }
    $d
      ->close();
    rmdir($path);
  }
}