/** * Recursively delete directory from storage * * @param string $path Target dir * @return void */ public function deleteDirectory($path) { if (!Mage::helper('uaudio_storage')->isEnabled()) { return parent::deleteDirectory($path); } // prevent accidental root directory deleting $rootCmp = rtrim($this->getHelper()->getStorageRoot(), DS); $pathCmp = rtrim($path, DS); if ($rootCmp == $pathCmp) { Mage::throwException(Mage::helper('cms')->__('Cannot delete root directory %s.', $path)); } if (!$this->_getStorageModel()->deleteDir($path)) { Mage::throwException(Mage::helper('cms')->__('Cannot delete directory %s.', $path)); } $this->_getStorageModel()->deleteDir($this->getThumbnailRoot() . DS . ltrim(substr($pathCmp, strlen($rootCmp)), '\\/')); }