Delete folder.

@param Request $request

@return ResultResponse
@Route("/delete", name="mediamanager_folder_delete")
7959
public function deleteAction(Request $request)
    {
        $volumeId = $request->get('site_id');
        $folderId = $request->get('folder_id');

        $volume = $this->getVolume($volumeId);
        $folder = $volume->findFolder($folderId);

        if ($folder->isRoot()) {
            return new ResultResponse(false, "Can't delete the root folder.");
        }

        $volume->deleteFolder($folder, $this->getUser()->getId());

        return new ResultResponse(true, 'Folder deleted', ['parent_id' => $folder->getParentId()]);
    }
891952
public function repeaterEntriesDelete(Request $request)
    {
        // AUTHORIZE ... COMES HERE
        $status = $this->content->deleteById($request->get('repeater_id'));
        return $status;
    }
460090
public function destroy(Request $request)
    {
        $this->api('category.delete', $request->route('category'))->parameters($request->all())->delete();

        Forum::alert('success', 'categories.deleted', 1);

        return redirect(config('forum.routing.prefix'));
    }
1072312
public function deleteCategory(Request $request)
    {
        $this->validate(
            $request,
            [
                'category_id' => 'required|integer|exists:categories',
            ]
        );

        $category = Category::find($request->input('category_id'));

        if ($category->items()->count()) {
            return redirect()->back()->withErrors(['category_id' => trans('mustard::admin.category_has_items')]);
        }

        $category->delete();

        return redirect()->back()->withStatus(trans('mustard::admin.category_deleted'));
    }
1066079
public function deleteAction(Request $request, Media $media)
    {
        $user = $this->getBlogUser();
        $mediaLibrary = $this->container->get('sonata.media.manager.gallery')->findOneBy(array('name' => 'Media Library'));
        $em = $this->getDoctrine()->getManager();

        foreach($media->getGalleryHasMedias() as $hasMedia)
        {
            if($hasMedia->getGallery() == $mediaLibrary)
            {
                $em->remove($hasMedia);
            }
        }

        $em->flush();

        if($request->isXmlHttpRequest())
        {
            return new JsonResponse(array('success' => 'true'));
        }

        $this->get('session')->getFlashBag()->add('success', 'Photo removed successfully.');
        return $this->redirectToRoute('ed_blog_admin_media_list');
    }
957130
public function postDeletePhoto(Request $request)
    {
        if (session()->has('photos')) {
            $photos = session('photos');

            foreach ($photos as $index => $photo) {
                if (in_array($request->input('file'), $photo)) {
                    $photo = Photo::find($photo['photo_id']);

                    $photo->delete();

                    unset($photos[$index]);

                    session('photos', $photos);

                    return response('', 200);
                }
            }
        }

        return response('', 400);
    }
845349
public function folderZipAction(Request $request)
    {
        $folderId = $request->get('folder_id');

        $volumeManager = $this->get('phlexible_media_manager.volume_manager');
        $path = $this->container->getParameter('phlexible_media_manager.temp_dir');

        $filesystem = new Filesystem();
        $filesystem->mkdir($path);

        $volume = $volumeManager->getByFolderId($folderId);
        $folder = $volume->findFolder($folderId);

        $prefix = $folder->getPath();
        $prefixLength = 0;
        if ($prefix && mb_strpos($prefix, '/') !== false) {
            $prefix = mb_substr($prefix, 0, -mb_strlen('/'.$folder->getName()));
            $prefixLength = mb_strlen($prefix) + 1;
            $prefix = '';
        } elseif ($folder->isRoot()) {
            $prefix = $folder->getName().'/';
        } else {
            $prefix = '';
        }

        $filename = 'folder_'.$folder->getName().'_'.date('YmdHis');
        $filename = preg_replace('/[^a-zA-Z0-9-_]/', '_', $filename);
        $filename = $path.$filename.'.zip';

        $rii = new \RecursiveIteratorIterator(new FolderIterator($folder), \RecursiveIteratorIterator::SELF_FIRST);

        $files = [];
        foreach ($rii as $folder) {
            $folderPath = $folder->getPath().'/';
            foreach ($volume->findFilesByFolder($folder) as $file) {
                $displayName = $prefix.$folderPath.$file->getName();
                $displayName = mb_substr($displayName, $prefixLength, null, 'UTF-8');
                $files[$displayName] = $file->getPhysicalPath();
            }
        }

        $zippy = Zippy::load();
        $zippy->create($filename, $files);

        return new ResultResponse(true, 'Zip finished', ['filename' => basename($filename)]);
    }
297258
public function delete(Request $request)
    {
        $category = $this->category->find($request->get('category'));

        if (!$category) {
            return Response::json(['errors' => true]);
        }

        $this->category->destroy($category);

        return Response::json(['errors' => false]);
    }
172405
public function bulkDestroy(Request $request)
    {
        $this->validate($request, ['action' => 'in:delete,permadelete']);

        $parameters = $request->all();

        $parameters['force'] = 0;
        if (!config('forum.preferences.soft_deletes') || ($request->input('action') == 'permadelete')) {
            $parameters['force'] = 1;
        }

        $posts = $this->api('bulk.post.delete')->parameters($parameters)->delete();

        return $this->bulkActionResponse($posts, 'posts.deleted');
    }
1236538
public function cdeleteAction(Request $request)
    {
        $manager = $this->getTaskManager();

        $ids = array_filter(explode(',', $request->get('ids')));
        foreach ($ids as $id) {
            $manager->remove($id);
        }

        $this->getEntityManager()->flush();

        return $this->handleView($this->view());
    }
964841
public function trashAction(Request $request): Response
    {
        $form = $this->formFactory->trashLocationWithAsset(
            new LocationTrashWithAssetData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationTrashWithAssetData $data) {
                $location = $data->getLocation();
                $parentLocation = $this->locationService->loadLocation($location->parentLocationId);
                if ($data->getTrashAssets() === LocationTrashWithAssetType::RADIO_SELECT_TRASH_WITH_ASSETS) {
                    $content = $this->contentService->loadContentByContentInfo($location->contentInfo);
                    $relations = $this->contentService->loadRelations($content->versionInfo);
                    $imageLocation = $this->locationService->loadLocation($relations[0]->destinationContentInfo->mainLocationId);
                    $this->trashService->trash($imageLocation);
                }

                $this->trashService->trash($location);

                return $this->redirectToLocation($parentLocation);
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('ezplatform.trash.list'));
    }
368507
public function deleteAction(Request $request)
    {
        $siterootId = $request->get('id');

        $siterootManager = $this->get('phlexible_siteroot.siteroot_manager');

        $siteroot = $siterootManager->find($siterootId);
        $siterootManager->deleteSiteroot($siteroot);

        return new ResultResponse(true, 'Siteroot deleted.');
    }
916446
public function deleteAction(Request $request, Provincia $provincium)
    {
        $form = $this->createDeleteForm($provincium);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->remove($provincium);
            $em->flush();
        }

        return $this->redirectToRoute('provincia_index');
    }
1318672
public function moveMedia(Request $request)
    {
        @trigger_error(sprintf('The "%s" controller action is deprecated in KunstmaanMediaBundle 5.1 and will be removed in KunstmaanMediaBundle 6.0.', __METHOD__), E_USER_DEPRECATED);

        $mediaId = $request->request->get('mediaId');
        $folderId = $request->request->get('folderId');

        if (empty($mediaId) || empty($folderId)) {
            return new JsonResponse(['error' => ['title' => 'Missing media id or folder id']], 400);
        }

        $em = $this->getDoctrine()->getManager();
        $mediaRepo = $em->getRepository('KunstmaanMediaBundle:Media');

        $media = $mediaRepo->getMedia($mediaId);
        $folder = $em->getRepository('KunstmaanMediaBundle:Folder')->getFolder($folderId);

        $media->setFolder($folder);
        $mediaRepo->save($media);

        return new JsonResponse();
    }
760984
public function fileAction(Request $request)
    {
        $fileId = $request->get('file_id');

        $volumeManager = $this->get('phlexible_media_manager.volume_manager');

        $volume = $volumeManager->getByFileId($fileId);
        $file = $volume->findFile($fileId);

        $debug = [
            ['key' => 'mimeType', 'value' => $file->getMimeType()],
            ['key' => 'mediaType', 'value' => strtolower($file->getMediaType())],
            ['key' => 'fileId', 'value' => $file->getId()],
            ['key' => 'folderId', 'value' => $file->getFolderId()],
        ];

        return new JsonResponse(['debug' => $debug]);
    }
1129133
public function deleteMedia(Request $request)
    {
        // if single file/folder '?s=name'
        if ($request->has('s')) {
            if (is_dir(storage_path('app') . DIRECTORY_SEPARATOR . $request->input('s'))) {
                return $this->deleteDirectory($request);
            } else {
                return $this->deleteFile($request);
            }
        }

        // if multiple files
        if ($request->has('files')) {
            Storage::delete($request->input('files'));
        }

        // if multiple directories
        if ($request->has('directories')) {
            if (is_array($request->input('directories'))) {
                foreach ($request->input('directories') as $directory) {
                    Storage::deleteDirectory($directory);
                }
            } else {
                Storage::deleteDirectory($request->input('directories'));
            }
        }

        if ($request->wantsJson()) {
            return $this->notifySuccess('File/Folder deleted successfully!');
        }

        flash()->success('File/Folder deleted successfully!');

        return redirect()->back();
    }
914694
public function delete(Request $request)
    {
        $disk = Storage::disk($request->get('disk'));
        $file = $request->get('file');

        if ($disk->exists($file)) {
            $disk->delete($file);

            return response()->json([
                'status'  => true,
                'message' => trans('admin.delete_succeeded'),
            ]);
        }

        return response()->json([
            'status'  => false,
            'message' => trans('admin.delete_failed'),
        ]);
    }