function deleteFiles() { // Get the path $path = $this->getPath(); if (strlen($path) == 0 || $path == '/') { throw new Exception('backupSnapshot->deleteFiles: ' . "Error: Detected unsafe path for this snapshot to attempt to perform recursive delete on. Aborting."); } if (!is_dir($path)) { return true; } $deleter = new recursiveDeleter(); $deleter->delTree($path . '/'); return true; }
function deleteFiles() { // Get the path $path = $this->getPath(); // Deltree the directory if (strlen($path) == 0 || $path == '/') { throw new Exception('materializedSnapshot->destroy: ' . "Error: Detected unsafe path for this snapshot to attempt to perform recursive delete on. Aborting."); } // In many cases we already moved the directory to become the starting point for a new materialized snapshot // so we only attempt to remove if the dir exists if (is_link($path)) { if (!unlink($path)) { throw new Exception('materializedSnapshot->destroy: ' . "Error: Unable to remove symlink {$path} ."); } } if (is_dir($path)) { $deleter = new recursiveDeleter(); $deleter->delTree($path . '/'); } return true; }