private function processDeleteFolders() { if (count($this->path) < 1 or count($this->path) > 2) { throw $this->invalidRequestException(); } $roots = $this->env->filesystem()->getRootFoldersByKey(TRUE); // configuration/folders if (count($this->path) == 1) { $data = $this->request->data; if (!isset($data['ids'])) { throw $this->invalidRequestException(); } $ids = $data['ids']; if (!$ids or !is_array($ids) or count($ids) == 0) { throw $this->invalidRequestException(); } foreach ($ids as $id) { if (!array_key_exists($id, $roots)) { throw $this->invalidRequestException("Invalid root " . $id); } $folder = $roots[$id]; $this->env->configuration()->removeFolder($id); } $this->response()->success(TRUE); return; } $id = $this->path[1]; if (!array_key_exists($id, $roots)) { throw $this->invalidRequestException("Invalid root " . $id); } $folder = $roots[$id]; if ($this->request->hasParam("delete") and strcasecmp("true", $this->request->param("delete")) == 0) { $this->env->filesystem()->delete($folder, TRUE); } $this->env->configuration()->removeFolder($id); $this->env->events()->onEvent(FileEvent::delete($folder)); $this->response()->success($this->getSessionFolderInfo()); }
private function doDeleteItem($item, $sendEvent = TRUE, $removeId = TRUE, $removeFile = TRUE) { if ($removeFile) { $item->delete(); } $this->env->permissions()->removeFilesystemPermissions($item); if ($sendEvent) { $this->env->events()->onEvent(FileEvent::delete($item)); } if ($removeId) { $this->idProvider->delete($item); } }
public function delete($item) { Logging::logDebug('deleting [' . $item->id() . ']'); if ($item->isRoot()) { throw new ServiceException("INSUFFICIENT_PERMISSIONS", "Cannot delete root folders"); } $this->assertRights($item, self::PERMISSION_LEVEL_READWRITEDELETE, "delete"); $this->validateAction(FileEvent::DELETE, $item); $item->delete(); if ($this->env->features()->isFeatureEnabled("descriptions")) { $this->env->configuration()->removeItemDescription($item); } $this->env->permissions()->removeFilesystemPermissions($item); $this->env->events()->onEvent(FileEvent::delete($item)); $this->idProvider->delete($item); }