Пример #1
0
 public function execute(WorkingFolder $workingFolder, EventDispatcher $dispatcher)
 {
     // The root folder cannot be deleted.
     if ($workingFolder->getClientCurrentFolder() === '/') {
         throw new InvalidRequestException('Cannot delete resource type root folder');
     }
     $deleteFolderEvent = new DeleteFolderEvent($this->app, $workingFolder);
     $dispatcher->dispatch(CKFinderEvent::DELETE_FOLDER, $deleteFolderEvent);
     $deleted = false;
     if (!$deleteFolderEvent->isPropagationStopped()) {
         $deleted = $workingFolder->delete();
     }
     if (!$deleted) {
         throw new AccessDeniedException();
     }
     return array('deleted' => (int) $deleted);
 }