/**
  * Deletes this Tank's folder, and anything in it
  */
 public function delete_folder()
 {
     $dir = $this->get_folder_path();
     air2_rmdir($dir);
 }
 /**
  * Cleanup on delete
  *
  * @param unknown $event
  */
 public function postDelete($event)
 {
     if ($this->img_uuid) {
         $dir = self::get_directory($this->img_ref_type, $this->img_uuid);
         air2_rmdir($dir);
     }
     parent::postDelete($event);
 }
/**
 * Recursively remove a directory
 *
 * @param string  $dir
 */
function air2_rmdir($dir)
{
    if (is_dir($dir)) {
        $scan = glob("{$dir}/*");
        foreach ($scan as $path) {
            if (is_file($path)) {
                unlink($path);
            } else {
                air2_rmdir($path);
            }
        }
        rmdir($dir);
    }
}
 /**
  * Constructor
  *
  * Make sure temp-file directory is writable.
  *
  * @param string  $directory
  * @param array   $config
  */
 function __construct($directory, $config)
 {
     // check directory existence
     air2_rmdir($directory);
     // clean any old files
     if (!air2_mkdir($directory)) {
         throw new Exception("Unable to create directory {$directory}");
     }
     // make sure directory is writable
     if (!is_writable($directory)) {
         throw new Exception("Unable to write to directory {$directory}");
     }
     $this->output_dir = $directory;
     $this->config = $config;
     // create a yaml dumper
     $this->dumper = new sfYamlDumper();
 }