.scripts/symbiota.php
/**
   * Internal recursive function to delete all contents within a folder
   * before removing the folder itself.
   *
   * @param String $path -- The folder to delete.
   */
Internal recursive function to delete all contents within a folder
before removing the folder itself.

@param String $path -- The folder to delete.
Internal recursive function to delete all contents within a folder before removing the folder itself . @param String $path -- The folder to delete .
private function deleteFolder($path) {
    if (!is_dir($path)) {
      throw new InvalidArgumentException("$path must be a directory.");
    }
    if (substr($path, strlen($path) - 1, 1) !== "/") {
      $path .= "/";
    }
    foreach (scandir($path) as $count=>$file) {
      if ($file === "." || $file === "..") {
        continue;
      }
      if (is_dir($file)) {
        $this->deleteFolder($file);
      } else {
        $this->logger("Deleting file: " . $path . $file);
        unlink($path . $file);
      }
    }
    rmdir($path);
  }
private function deleteFolder ( $ path ) { if ( ! is_dir ( $ path ) ) { throw new InvalidArgumentException ( " $ path  must be a directory. " ) ; } if ( substr ( $ path , strlen ( $ path ) - 1 , 1 ) !== " / " ) { $ path .= " / " ; } foreach ( scandir ( $ path ) as $ count => $ file ) { if ( $ file === " . " || $ file === " .. " ) { continue ; } if ( is_dir ( $ file ) ) { $ this -> deleteFolder ( $ file ) ; } else { $ this -> logger ( " Deleting file:  " . $ path . $ file ) ; unlink ( $ path . $ file ) ; } } rmdir ( $ path ) ; }
Internal recursive function to delete all contents within a folder
 before removing the folder itself.
Internal recursive function to delete all contents within a folder before removing the folder itself .
// Check if we're actually a directory. // Check if we have a trailing slash. // Run through each entity and either delete the file or restart // folder deletion process.