function rec_unlink($path) { @($dir = opendir($path)); if ($dir) { while (($file = readdir($dir)) != false) { if ($file != '.' && $file != '..') { rec_unlink($path . '/' . $file); } } } @closedir($dir); @unlink($path); @rmdir($path); }
function Destroy() { if ($this->RefCount() > 0) { return; } db_query('DELETE FROM `storage` WHERE `id`=' . $this->id); db_destroy_table('storage_volume_' . $this->id); rec_unlink($this->GetFullPath()); manage_storage_unregister($this->id); }