Action - Do the actual deploy

@param SS_HTTPRequest $request
772466
public function deploy(SS_HTTPRequest $request) {
		$params = $request->params();
		$deployment = DNDeployment::get()->byId($params['Identifier']);

		if(!$deployment || !$deployment->ID) throw new SS_HTTPResponse_Exception('Deployment not found', 404);
		if(!$deployment->canView()) return Security::permissionFailure();

		$environment = $deployment->Environment();
		$project = $environment->Project();

		if($environment->Name != $params['Environment']) throw new LogicException("Environment in URL doesn't match this deploy");
		if($project->Name != $params['Project']) throw new LogicException("Project in URL doesn't match this deploy");

		return $this->customise(new ArrayData(array(
			'Deployment' => $deployment,
		)))->renderWith('DNRoot_deploy');
	}
1111589
public function run (Request $request)
    {
        try {

            // Define which method we need to handle
            $this->method = $request->getMethod();

            // Set request
            $this->request = $request;

            // Handle all routes
            $numHandled = 0;
            if (isset($this->routes[$this->method]))
                $numHandled = $this->handle($this->routes[$this->method], true);

            // If no route was handled, trigger the 404 (if any)
            if ($numHandled == 0) {
                if ($this->notFound) {
                    //call_user_func($this->notFound);
                    $this->handleMatch($this->notFound, array());
                } else {

                    $request = Response::error('Page not found.', Response::STATUS_NOTFOUND);
                    $request->output();
                }
            }

            // If it originally was a HEAD request, clean up after ourselves by emptying the output buffer
            if ($_SERVER['REQUEST_METHOD'] == 'HEAD') ob_end_clean();

        } catch (ResponseException $e) {
            $e->getResponse()->output();
        }
    }
262373
public function uploadsnapshot(SS_HTTPRequest $request) {
		// Performs canView permission check by limiting visible projects
		$project = $this->getCurrentProject();
		if(!$project) {
			return new SS_HTTPResponse("Project '" . Convert::raw2xml($request->latestParam('Project')) . "' not found.", 404);
		}

		if(!$project->canUploadArchive()) {
			return new SS_HTTPResponse("Not allowed to upload", 401);
		}

		return $this->customise(array(
			'Project' => $project,
			'CurrentProject' => $project,
			'SnapshotsSection' => 1,
			'UploadLimit' => $maxSize = File::format_size(min(
				File::ini2bytes(ini_get('upload_max_filesize')),
				File::ini2bytes(ini_get('post_max_size'))
			)),
			'UploadSnapshotForm' => $this->getUploadSnapshotForm($request),
			'PostSnapshotForm' => $this->getPostSnapshotForm($request)
		))->renderWith(array('DNRoot_uploadsnapshot', 'DNRoot'));
	}
825554
public function run($request)
    {
        $currentSite = Multisites::inst()->getCurrentSite();
        $folderName  = $currentSite->Host ? $currentSite->Host : "site-$currentSite->ID";
        $folder      = Folder::find_or_make($folderName);

        $files = File::get()->filter('ParentID', array(0))->exclude('ID', $folder->ID);

        if (!$files->count()) {
            return;
        }

        foreach ($files as $file) {
            if (file_exists($file->getFullPath())) {
                $file->ParentID = $folder->ID;
                $file->write();
                echo $file->Filename.' moved <br />';
            }
        }
    }
1013862
public function handleDelete(SS_HTTPRequest $request)
    {
        if (!$this->file->canDelete()) {
            return $this->httpError(403);
        }

        $this->file->delete();

        return new SS_HTTPResponse('OK');
    }
736231
public function handle(HTTPRequest $request)
    {
        $flush = array_key_exists('flush', $request->getVars()) || ($request->getURL() === 'dev/build');

        // Ensure boot is invoked
        return $this->execute($request, function (HTTPRequest $request) {
            return Director::singleton()->handleRequest($request);
        }, $flush);
    }
241690
public function createsnapshot(SS_HTTPRequest $request) {
		// Performs canView permission check by limiting visible projects
		$project = $this->getCurrentProject();
		if(!$project) {
			return new SS_HTTPResponse("Project '" . Convert::raw2xml($request->latestParam('Project')) . "' not found.", 404);
		}

		if(!$project->canBackup()) {
			return new SS_HTTPResponse("Not allowed to create snapshots on any environments", 401);
		}

		return $this->customise(array(
			'Title' => 'Create Data Snapshot',
			'Project' => $project,
			'CurrentProject' => $project,
			'SnapshotsSection' => 1,
			'DataTransferForm' => $this->getDataTransferForm($request)
		))->renderWith(array('DNRoot_createsnapshot', 'DNRoot'));
	}
211225
public function run(Request $request) {
    // process the requested action
    ObjectFactory::getInstance('actionMapper')->processAction($request, $this->response);
    return $this->response;
  }
363646
public function run($request)
    {
        // Loading packages and all their updates can be quite memory intensive.
        $memoryLimit = $this->config()->get('memory_limit');
        if ($memoryLimit) {
            if (Environment::getMemoryLimitMax() < Convert::memstring2bytes($memoryLimit)) {
                Environment::setMemoryLimitMax($memoryLimit);
            }
            Environment::increaseMemoryLimitTo($memoryLimit);
        }

        $composerLock = $this->getComposerLoader()->getLock();
        $rawPackages = array_merge($composerLock->packages, (array) $composerLock->{'packages-dev'});
        $packages = $this->getPackageInfo($rawPackages);

        // Get "name" from $packages and put into an array
        $moduleNames = array_column($packages, 'Name');

        $supportedPackages = $this->getSupportedPackages();
        $moduleHealthInfo = $this->getHealthIndicator($moduleNames);

        // Extensions to the process that add data may rely on external services.
        // There may be a communication issue between the site and the external service,
        // so if there are 'none' we should assume this is untrue and _not_ proceed
        // to remove everything. Stale information is better than no information.
        if ($packages) {
            // There is no onBeforeDelete for Package
            $table = DataObjectSchema::create()->tableName(Package::class);
            SQLDelete::create("\"$table\"")->execute();
            foreach ($packages as $package) {
                $packageName = $package['Name'];
                if (is_array($supportedPackages)) {
                    $package['Supported'] = in_array($packageName, $supportedPackages);
                }
                if (is_array($moduleHealthInfo) && isset($moduleHealthInfo[$packageName])) {
                    $package['Rating'] = $moduleHealthInfo[$packageName];
                }
                Package::create()->update($package)->write();
            }
        }
    }
532496
public function run(Request $request = null)
    {
        $this->init();
        $this->getLogger()->debug('Application launched');
        if (!($request instanceof Request)) {
            $appMode = $this->detectRunMode();
            if ($appMode == self::MODE_WEB) {
                $request = Request\Web::makeFromGlobals();
            } else {
                $request = Request\Cli::makeFromGlobals();
            }
        }
        $this->setupRouter($request);
        $response = $this->execute($request);
        $this->output($response);
        $this->getLogger()->debug('Application execution completed');
    }
402463
public function run(Request $request)
    {
        $this->dataRepository->runProjectTests($request->get('projects'));

        return $this->success();
    }
264077
public function run($request)
    {
        $email = $request->getVar('email');

        if (!$email) {
            echo 'You must supply an email parameter to this method.', PHP_EOL;
            exit;
        }

        $user = $this->ldapService->getUserByEmail($email);

        if (!$user) {
            echo sprintf('No user found in LDAP for email %s', $email), PHP_EOL;
            exit;
        }

        $member = $this->findOrCreateMember($user);

        // If member exists already, we're updating - otherwise we're creating
        if ($member->exists()) {
            $this->log(sprintf(
                'Updating existing Member %s: "%s" (ID: %s, SAM Account Name: %s)',
                $user['objectguid'],
                $member->getName(),
                $member->ID,
                $user['samaccountname']
            ));
        } else {
            $this->log(sprintf(
                'Creating new Member %s: "%s" (SAM Account Name: %s)',
                $user['objectguid'],
                $user['cn'],
                $user['samaccountname']
            ));
        }

        $this->log('User data returned from LDAP follows:');
        $this->log(var_export($user));

        try {
            $this->ldapService->updateMemberFromLDAP($member, $user);
            $this->log('Done!');
        } catch (Exception $e) {
            $this->log($e->getMessage());
        }
    }
1201574
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $details = ArrayObject::ensureArrayObject($request->getModel());

        if (isset($details['RtnCode']) === false) {
            $request->markNew();

            return;
        }

        if ($details['RtnCode'] === '2') {
            $request->markPending();

            return;
        }

        if ($details['RtnCode'] === '1') {
            if (isset($details['Action']) === true) {
                switch ($details['Action']) {
                    case 'C':
                        $request->markCaptured();
                        break;
                    case 'R':
                        $request->markRefunded();
                        break;
                    case 'E':
                    case 'N':
                        $request->markCanceled();
                        break;
                }

                return;
            } else {
                $request->markCaptured();

                return;
            }
        }

        $request->markFailed();
    }
568518
public function save(HTTPRequest $request)
    {
        if ($this->changedData) {
            $this->finalize($request);

            if (!$this->isStarted()) {
                $this->start($request);
            }

            // Apply all changes recursively, implicitly writing them to the actual PHP session store.
            $this->recursivelyApplyChanges($this->changedData, $this->data, $_SESSION);
        }
    }
233056
public function moveAction(Request $request)
    {
        $section = $this->getSection($request->query->get('id'), true);

        $terms = $section->getTerms();

        // [OP 2014-09-07] Verify that the target section is part of the same terms!
        $dest = $this->getQuery()
            ->filterByTermsId($terms->getId())
            ->findPk($request->query->get('dest_id'));

        if (!$request->isXmlHttpRequest() || !$dest) {
            throw $this->createNotFoundException('Section not found');
        }

        $data = array();

        try {
            switch ($request->query->get('as')) {
                case 'child':
                    $section->moveToFirstChildOf($dest);
                    break;
                case 'sibling':
                    $dest->isRoot() ?
                        $section->moveToFirstChildOf($dest)
                        : $section->moveToNextSiblingOf($dest);
                    break;
                default:
                    $section->moveToLastChildOf($dest);
                    break;
            }

            $data['success'] = true;
            $this->get('session')->getFlashBag()->add(
                'notice',
                $this->get('translator')->trans('section.move.success', array(), 'CPTermsBundle', $request->getLocale())
            );

        } catch (RuntimeException $e) {
            $data['success'] = false;
            $this->get('session')->getFlashBag()->add(
                'notice',
                $this->get('translator')->trans('section.move.error', array(), 'CPTermsBundle', $request->getLocale())
            );

        }

        return new Response(json_encode($data), 200, array('Content-Type' => 'application/json'));
    }
492551
private function createRequest(Request $request = null): void
    {
        if (!$this->request && is_null($request)) {
            $request = ServerRequest::fromGlobals()
                ->withParsedBody(json_decode(file_get_contents('php://input')));
        }

        $this->container->set(Request::class, $request);
        $this->request = $request;
    }
629798
public function moveAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $folder = $this->findFolderById($request->attributes->get('id'));

        $result = [];
        $mode = $request->request->get('mode');

        if (!in_array($mode, array('before', 'after', 'over'))) {
            $result = array(
                'error'   => true,
                'message' => 'Unexpected creation mode.',
            );
        } else {
            $reference = $this->findFolderById($request->request->get('reference'));

            if ($mode === 'before') {
                $this->getFolderRepository()->persistAsPrevSiblingOf($folder, $reference);
            } elseif ($mode === 'after') {
                $this->getFolderRepository()->persistAsNextSiblingOf($folder, $reference);
            } elseif ($mode === 'over') {
                $this->getFolderRepository()->persistAsLastChildOf($folder, $reference);
            }
            $this->getEntityManager()->flush();
        }

        $response = new Response(json_encode($result, JSON_FORCE_OBJECT));
        $response->headers->add(array('Content-Type' => 'application/json'));
        return $response;
    }