public function purge($path = null)
{
if (!$path) {
$path = $this->_realpath;
}
if ($this->getIsFile()) {
if ($this->getWriteable()) {
$this->setContents('');
return True;
}
} else {
$this->addLog('Purging directory "' . $path . '"', 'trace');
$contents = $this->dirContents($path, True);
foreach ($contents as $item) {
if (is_file($item)) {
@unlink($item);
} elseif (is_dir($item)) {
$this->purge($item);
@rmdir($item);
}
}
// TODO hey, still need a valid check here
return True;
}
return False;
}