UnPublish the selected records passed from the unPublish bulk action.

@param HTTPRequest $request

@return HTTPBulkToolsResponse
545767
public function unPublish(HTTPRequest $request)
    {
        $records = $this->getRecords();
        $response = new HTTPBulkToolsResponse(false, $this->gridField);
        
        try {
            foreach ($records as $record)
            {
                $done = $record->doUnpublish();
                if ($done)
                {
                    $response->addSuccessRecord($record);
                }else{
                    $response->addFailedRecord($record, $done);
                }
            }

            $doneCount = count($response->getSuccessRecords());
            $failCount = count($response->getFailedRecords());
            $message = sprintf(
                'UnPublished %1$d of %2$d records.',
                $doneCount,
                $doneCount + $failCount
            );
            $response->setMessage($message);
        } catch (Exception $ex) {
            $response->setStatusCode(500);
            $response->setMessage($ex->getMessage());
        }

        return $response;
    }
299047
function unshift(\CharlotteDunois\Yasmin\HTTP\APIRequest $request) {
        \array_unshift($this->queue, $request);
        
        $this->get()->then(function ($data) {
            $data['remaining']++;
            
            return $this->set($data);
        })->done(null, array($this->api->client, 'handlePromiseRejection'));
        
        return $this;
    }
884798
public function delete(SS_HTTPRequest $request)
    {
        // Check form field state
        if ($this->parent->isDisabled() || $this->parent->isReadonly()) {
            return $this->httpError(403);
        }

        // Protect against CSRF on destructive action
        $token = $this->parent->getForm()->getSecurityToken();
        if (!$token->checkRequest($request)) {
            return $this->httpError(400);
        }

        // Check item permissions
        $item = $this->getItem();
        if (!$item) {
            return $this->httpError(404);
        }

        $memberID = Member::currentUserID();

        $res = false;
        try {
            // Owner can always delete
            if ($memberID && $item->OwnerID == $memberID) {
                $res = true;
            } else {
                $res = $item->canDelete();
            }
        } catch (Exception $ex) {

        }

        if (!$res) {
            return $this->httpError(403);
        }

        // Delete the file from the filesystem. The file will be removed
        // from the relation on save
        // @todo Investigate if references to deleted files (if unsaved) is dangerous
        $item->delete();

        if (Controller::has_curr()) {
            return Controller::curr()->redirectBack();
        }
        return $this;
    }
1099444
public function uninstall(Request $request)
    {
        $package = $request->get('package');

        try {
            $response = $this->manager()->removePackage([$package]);
        } catch (\Exception $e) {
            return $this->getJsonException($e);
        }

        if ($response === 0) {
            $this->app['logger.system']->info("Uninstalled $package", ['event' => 'extensions']);

            return new Response($this->manager()->getOutput());
        }

        return $this->getJsonException(new PackageManagerException($this->manager()->getOutput(), $response));
    }
541144
public function removeAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);
        $content = $container->getContent();

        try {
            $this->getEditor()->getContainerManager()->delete($container);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        // Stores id for front removal
        $removedId = $this->getViewBuilder()->buildContainer($container)->getAttributes()->getId();

        $this->validate($content);
        $this->persist($content);

        $data = [
            'removed' => [$removedId],
            //'contents' => [$this->getViewBuilder()->buildContent($content)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
802815
public function upload(HTTPRequest $request)
    {
        if ($this->isDisabled() || $this->isReadonly()) {
            return $this->httpError(403);
        }

        // Protect against CSRF on destructive action
        $token = $this->getForm()->getSecurityToken();
        if (!$token->checkRequest($request)) {
            return $this->httpError(400);
        }

        $tmpfile = $request->postVar('Upload');

        // Check if the file has been uploaded into the temporary storage.
        if (!$tmpfile) {
            $return = [
                'error' => _t(
                    'SilverStripe\\AssetAdmin\\Forms\\UploadField.FIELDNOTSET',
                    'File information not found'
                )
            ];
        } else {
            $return = [
                'name' => $tmpfile['name'],
                'size' => $tmpfile['size'],
                'type' => $tmpfile['type'],
                'error' => $tmpfile['error']
            ];
        }

        if (!$return['error']) {
            // Get options for this import.
            $splitHeader = (int)$request->postVar('SplitHeader');
            $keepSource = (bool)$request->postVar('KeepSource');
            $chosenFolderID = (int)$request->postVar('ChosenFolderID');
            $publishPages = (bool)$request->postVar('PublishPages');
            $includeTOC = (bool)$request->postVar('IncludeTOC');

            // Process the document and write the page.
            $preservedDocument = null;
            if ($keepSource) {
                $preservedDocument = $this->preserveSourceDocument($tmpfile, $chosenFolderID);
            }

            $importResult = $this->importFromPOST($tmpfile, $splitHeader, $publishPages, $chosenFolderID);
            if (is_array($importResult) && isset($importResult['error'])) {
                $return['error'] = $importResult['error'];
            } elseif ($includeTOC) {
                $this->writeTOC($publishPages, $keepSource ? $preservedDocument : null);
            }
        }

        $response = HTTPResponse::create(Convert::raw2json([$return]));
        $response->addHeader('Content-Type', 'application/json');
        return $response;
    }
1307970
public function removeAction(Request $request): Response
    {
        $form = $this->formFactory->removeLocation(
            new ContentLocationRemoveData()
        );
        $form->handleRequest($request);

        /** @var \eZ\Publish\API\Repository\Values\Content\ContentInfo $contentInfo */
        $contentInfo = $form->getData()->getContentInfo();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (ContentLocationRemoveData $data) {
                $contentInfo = $data->getContentInfo();

                foreach ($data->getLocations() as $locationId => $selected) {
                    $location = $this->locationService->loadLocation($locationId);
                    $this->locationService->deleteLocation($location);

                    $this->notificationHandler->success(
                        $this->translator->trans(
                            /** @Desc("Location '%name%' removed.") */
                            'location.delete.success',
                            ['%name%' => $location->getContentInfo()->name],
                            'location'
                        )
                    );
                }

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                    'locationId' => $contentInfo->mainLocationId,
                    '_fragment' => LocationsTab::URI_FRAGMENT,
                ]));
            });

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

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $contentInfo->mainLocationId,
            '_fragment' => LocationsTab::URI_FRAGMENT,
        ]));
    }
818685
public function destroy(Request $request)
    {
        $this->validate($request, ['action' => 'in:delete,permadelete']);

        $permanent = !config('forum.preferences.soft_deletes') || ($request->input('action') == 'permadelete');

        $parameters = $request->all();
        $parameters['force'] = $permanent ? 1 : 0;

        $thread = $this->api('thread.delete', $request->route('thread'))->parameters($parameters)->delete();

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

        return redirect($permanent ? Forum::route('category.show', $thread->category) : Forum::route('thread.show', $thread));
    }
450551
public function deletesnapshot($request) {
		$dataArchive = DNDataArchive::get()->byId($request->param('DataArchiveID'));

		if(!$dataArchive) {
			throw new SS_HTTPResponse_Exception('Archive not found', 404);
		}

		if(!$dataArchive->canDelete()) {
			throw new SS_HTTPResponse_Exception('Not allowed to delete archive', 403);
		}

		$form = $this->getDeleteForm($this->request, $dataArchive);

		// View currently only available via ajax
		return $form->forTemplate();
	}
704365
public function doUnpublish($data, $form)
    {
        /** @var Versioned|DataObject $record */
        $record = $this->getRecord();
        if (!$record->canUnpublish()) {
            return $this->httpError(403);
        }

        // Record name before it's deleted
        $title = $record->Title;
        $record->doUnpublish();

        $message = _t(
            __CLASS__ . '.Unpublished',
            'Unpublished {name} {title}',
            [
                'name' => $record->i18n_singular_name(),
                'title' => Convert::raw2xml($title)
            ]
        );
        $this->setFormMessage($form, $message);

        // Redirect back to edit
        return $this->redirectAfterSave(false);
    }
1019620
public function removeFromOrderAction(Request $request)
    {
        $updater = $this->container->get('librinfo_ecommerce.order.item_updater');

        $result = $updater->updateItemCount($request->get('order'), $request->get('item'), false);

        if ($result['lastItem'] != null) {
            $result['message'] = $this->container->get('translator')->trans('There must be at least one item left in the order');
        }

        return new JsonResponse($result);
    }
721875
protected function manipulateSubtableRequest($request)
    {
        $request['totals']        = 0;
        $request['expanded']      = 0;
        $request['filter_limit']  = -1;
        $request['filter_offset'] = 0;
        $request['filter_sort_column'] = '';

        $parametersToRemove = array('flat');

        if (!array_key_exists('idSubtable', $this->request)) {
            $parametersToRemove[] = 'idSubtable';
        }

        foreach ($parametersToRemove as $param) {
            if (array_key_exists($param, $request)) {
                unset($request[$param]);
            }
        }
        return $request;
    }
1228632
public function annihilate($request)
    {
        $record = $this->recordFromRequest($request);

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

        $isVersioned = $record->hasExtension('Versioned');

        $clone = null;
        $title = $record->Title ? $record->Title : 'Record #' . $record->ID;

        try {
            if ($isVersioned) {
                $clone = clone $record;
            }

            $record->delete();

            if ($clone) {
                $clone->deleteFromStage('Live');
                $versions = $clone->baseTable() . '_versions';
                DB::query("DELETE FROM \"{$versions}\" WHERE \"RecordID\" = '{$clone->ID}'");
            }
        } catch (Exception $e) {
            return $this->respondWithMessage(false, $e->getMessage(), 401);
        }

        $message = rawurlencode(_t(
            'CMSMain.DELETED_PAGE',
            "Deleted '{title}'",
            ['title' => $title]
        ));

        return $this->respondWithMessage(true, $message, 200);
    }
460913
public function bulkDelete(Request $request)
    {
        foreach ($request->all() as $id){
            if (!$this->deleteUser($id)) {
                return $this->response('Internal server error. Please try again later', 500);
            }
        }
        return $this->response('Users are deleted');
    }
893119
public function stopAction(Request $request)
    {
        $treeId = (int) $request->get('tree_id');
        $teaserId = (int) $request->get('teaser_id');

        $dispatcher = $this->get('event_dispatcher');
        $teaserManager = $this->get('phlexible_teaser.teaser_manager');

        $teaser = $teaserManager->find($teaserId);
        $teaser->addStopId($treeId);

        $event = new TeaserEvent($teaser);
        if ($dispatcher->dispatch(TeaserEvents::BEFORE_STOP_TEASER, $event)->isPropagationStopped()) {
            throw new RuntimeException('Stop inherit cancelled by event');
        }

        $teaserManager->updateTeaser($teaser);

        $event = new TeaserEvent($teaser);
        $dispatcher->dispatch(TeaserEvents::STOP_TEASER, $event);

        return new ResultResponse(true, 'Inheritance stopped');
    }
799853
function unshift(\CharlotteDunois\Yasmin\HTTP\APIRequest $request) {
        \array_unshift($this->queue, $request);
        $this->remaining++;
        return $this;
    }
647671
public function delete($request)
    {
        $entriesCleared = 0;

        if ($this->exists($request)) {
            foreach ($this->entries as $entry) {
                if ($entry['cacheData']) {
                    // delete each results of the manifest
                    if ($this->cache->delete($entry['cacheData'])) {
                        $entriesCleared++;
                    }
                }
            }
            // delete the manifest of data source
            $this->cache->delete($this->key);
        }
        return $entriesCleared;
    }