/** * DELETE method handler * * @param array general parameter passing array * @return bool true on success */ public function DELETE($aOptions) { $sFullPath = $this->absolutePath($aOptions["path"]); //Top-level directories may not be deleted by non-admins $bIsTopLevel = count(explode('/', $aOptions['path'])) <= 1; if ($bIsTopLevel && !$this->hasWriteAccess('')) { return '403 Forbidden'; } if ($bIsTopLevel) { $oCriteria = new Criteria(); $oCriteria->add(DirectoryPermissionPeer::FILENAME, $aOptions['path']); DirectoryPermissionPeer::doDelete($oCriteria); } if (!$this->hasWriteAccess($aOptions['path'])) { return '403 Forbidden'; } if (!file_exists($sFullPath)) { return "404 Not found"; } ResourceFinder::recursiveUnlink($sFullPath); return "204 No Content"; }
public function delete() { $aDirPermissionsGroups = DirectoryPermissionPeer::getPermissionsByFileName($this->sFilePath); foreach ($aDirPermissionsGroups as $oDirPermGroup) { $oDirPermGroup->delete(); } ResourceFinder::recursiveUnlink("{$this->sWebdavBaseDirPath}/{$this->sFilePath}"); LinkUtil::redirect($this->link()); }