Execute command in background.

@param Request $request

@return Response
495178
public function execAction(Request $request)
    {
        ignore_user_abort(true);
        set_time_limit(0);

        $this->get('anime_db.command')->execute($request->get('command'), 0);

        return new Response();
    }
88475
public function run(HttpRequest $request = null): Response
    {
        if ($request === null) {
            $request = HttpRequest::fromGlobals();
        }

        $this->httpRequest = $request;

        $context = new Context($request->getUri()->getPath(), $request);

        $response = $this->getHttpRouter()->route($context);

        if (!$response instanceof HttpResponse) {
            $response = new HttpResponse($response);
        }

        $this->flushResponse($request, $response);

        $this->httpRequest = null;

        return $response;
    }
1202005
public function execute(Request $request)
    {
        $command = $request->get('command');

        try {
            $result = $this->manager()->execute($command);
        } catch (\Exception $exception) {
            return $this->renderException($exception);
        }

        if (is_string($result) && Str::startsWith($result, ['ERR ', 'WRONGTYPE '])) {
            return $this->renderException(new \Exception($result));
        }

        return $this->getDumpedHtml($result);
    }
879455
public function run(Request $request)
    {
        $this->container = $this->container ?: Application::getInstance();
        $this->container->set(Request::class, $request);

        // Check and run controller
        if ($this->isControllerAction()) {
            return $this->runController();
        }

        return $this->runCallable();
    }
232772
public function execute(Request $request)
    {
        if (!$this->requireProvider("Executing cache request")) return null;

        $cacheKey = $request->getCacheKey();

        if (empty($cacheKey)) {
            if (!empty($this->log)) $this->log->error("Invalid or missing cache key.");
            return null;
        }

        $cacheRefresh = $request->getForceRefresh();

        if (!$cacheRefresh) {
            $cacheData = $this->cacheProvider->get($cacheKey);

            if (!empty($cacheData)) {
                if (!empty($this->log)) $this->log->debug("Cache hit on key " . $cacheKey);

                return $cacheData;
            }
        }

        if (!empty($this->log)) $this->log->debug("CACHE", "Cache miss on key " . $cacheKey);

        $value = $request->executeCallback();

        if (!empty($value)) {
            $this->cacheProvider->set($cacheKey, $value, $request->getCacheTTL());
        }

        return $value;
    }
425412
public function run(Request $request = NULL)
    {
        if ( !$request ) {
            $request = Request::createFromGlobals();
        }

        $this->getServiceManager()->add(get_class($request), $request);

        // Retrieve the middlewares list
        $httpMiddlewares = $this->config->get('middlewares', []);
        ksort($httpMiddlewares);

        $bus = new Pipe($this->getServiceManager());

        $pipe = $bus->pipe(
            $httpMiddlewares
        );

        $response = $pipe($request);
        $response->send();
    }
1107677
public function runTask($request)
    {
        $name = $request->param('TaskName');
        $tasks = $this->getTasks();

        $title = function ($content) {
            printf(Director::is_cli() ? "%s\n\n" : '<h1>%s</h1>', $content);
        };

        $message = function ($content) {
            printf(Director::is_cli() ? "%s\n" : '<p>%s</p>', $content);
        };

        foreach ($tasks as $task) {
            if ($task['segment'] == $name) {
                /** @var BuildTask $inst */
                $inst = Injector::inst()->create($task['class']);
                $title(sprintf('Running Task %s', $inst->getTitle()));

                if (!$inst->isEnabled()) {
                    $message('The task is disabled');
                    return;
                }

                $inst->run($request);
                return;
            }
        }

        $message(sprintf('The build task "%s" could not be found', Convert::raw2xml($name)));
    }
135814
public function runBeforeSendingCallbacks(Request $request): Request
    {
        return tap($request, function ($request) {
            $this->beforeSendingCallbacks->each->__invoke(new HttpRequest($request));
        });
    }
614616
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

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

        if (null === $model['error_code']) {
            $request->markNew();
            return;
        }

        if (self::SUCCESS === $model['error_code']) {
            $request->markCaptured();
            return;
        }

        $request->markFailed();

    }
809071
public function execute($request)
    {
        ob_start();
        $logger          = $GLOBALS['logger'];
        $this->_request  = $request;
        $this->_response = new HttpResponse();
        try {
            WebSessionManager::updateActiveSession();
            foreach ($this->_preProcessors as $preProcessor) {
                $preProcessor->process($this->_request);
            }

            $functionToCall = $this->command->getFunction();
            if (empty($functionToCall) === true) {
                $functionToCall = 'default';
            }

            if (!is_callable(array(&$this,'_'.$functionToCall))) {
                $functionToCall = 'error';
            }

            call_user_func(array(&$this,'_'.$functionToCall), $this->_request);
            foreach ($this->_postProcessors as $postProcessor) {
                $postProcessor->process($this->_response);
            }

            ob_end_clean();
            if (empty($this->_response)) {
                $this->_response = new HttpResponse(); 
            }

            if($this->_response->getEncoding() == null) {
                $responseMode = $this->_request->getParam('mode');
                if ($responseMode === 'ui') {
                    $this->_response->setEncoding('html');
                } else if ($responseMode === 'data') {
                    $this->_response->setEncoding('json');
                }
            }
            $this->_response->send();
        } catch (ServiceException $se) {
            $this->_response = new HttpResponse();
            $response->addHeader('HTTP/1.1 400 Bad Request');
            $this->_response->send();
        } catch(BadResponseException $bre) {
            $renderer = new TwigRenderer('500.html');
            if($renderer->exists()) {
                $this->_response = new HttpResponse('none', $renderer);
            } else 
                $this->_response = new HttpResponse();
            $response->addHeader('HTTP/1.1 500 Internal Server Error');
            $this->_response->send();
        }//end try

    }
782767
public function execute(Request $request, Position $position)
    {
        $response = $this->batchExecute([$request], $position);
        return $request->getResponse(current($response));
    }
763116
public function run(Request $request) {
		$prefs = $this->getServiceContainer()->getPreferenceLoader()->getSystemPreferences();
		$auth = $this->getServiceContainer()->getAuthManager();
		$auth->logout();
		return new RedirectResponse($prefs->getAccountUrl());
	}
802122
public function run(Request $request) {
		$params = new Parameters($request->query->all());
		$domain = new FunctionPhaseDomain($this->getServiceContainer());
		$payload = $domain->paginate($params);
		return $this->responder->run($request, $payload);
	}
1283086
public function run(Request $request = null)
    {
        if (null === $request) {
            $request = Request::createFromGlobals();
        }

        $this->registerMiddleware('Phprest\Middleware\ApiVersion');

        $app = $this->stackBuilder->resolve($this);

        $response = $app->handle($request, self::MASTER_REQUEST, false);
        $response->send();

        $app->terminate($request, $response);
    }
960992
public function handle(Request $request)
    {
        $this->currentUri = $request->fullUrl();

        $this->response = $this->app->prepareResponse($this->app->handle($request));

        return $this;
    }
974870
public function run(Request $request)
    {
        $this->container = $this->container ?: new Container;
        
        try {
            if (! is_string($this->action['uses'])) {
                return $this->runCallable($request);
            }
            
            list($class, $method) = explode('@', $this->action['uses']);
            $cl = new ClassLoader;
            $cl->addPsr4($this->getAppNamespace(), app('path'));
            $file = $cl->findFile($class);
            $cmd = 'php -l ' . $file;
            
            if (strpos(exec($cmd, $output), 'No syntax errors detected') === false) {
                $route = array_get($this->action, 'as', $this->action['uses']);
                $error = head(array_filter($output));
                
                throw new SyntaxErrorException($route, $error);
            }
            
            set_error_handler([$this, 'error']);
            
            if ($this->customDispatcherIsBound()) {
                return $this->runWithCustomDispatcher($request);
            }
            
            return $this->runController($request);
        } catch (HttpResponseException $e) {
            return $e->getResponse();
        }
    }
164768
public function handle(Request $request)
	{
		$response = $this->next($request);

		$class = $this->app->get('arguments')->get('class');
		$task  = $this->app->get('arguments')->get('task');

		$command   = new $class($this->app->get('output'), $this->app->get('arguments'));
		$shortName = strtolower(with(new \ReflectionClass($command))->getShortName());

		// Fire default before event
		Event::fire($shortName . '.' . 'before' . ucfirst($task));

		$command->{$task}();

		// Fire default after event
		Event::fire($shortName . '.' . 'after' . ucfirst($task));

		$this->app->get('output')->render();

		return $response;
	}