/** * Creates an event loop which takes orders from the parent process and executes * them in runtime mode. * * @return void */ public function handleRequest() { $sequence = $this->bootstrap->buildRuntimeSequence(); $sequence->invoke($this->bootstrap); $objectManager = $this->bootstrap->getObjectManager(); $systemLogger = $objectManager->get('TYPO3\\FLOW3\\Log\\SystemLoggerInterface'); $systemLogger->log('Running sub process loop.', LOG_DEBUG); echo "\nREADY\n"; try { while (TRUE) { $commandLine = trim(fgets(STDIN)); $systemLogger->log(sprintf('Received command "%s".', $commandLine), LOG_INFO); if ($commandLine === "QUIT\n") { break; } $request = $objectManager->get('TYPO3\\FLOW3\\Cli\\RequestBuilder')->build($commandLine); $response = new \TYPO3\FLOW3\Cli\Response(); if ($this->bootstrap->isCompiletimeCommand($request->getCommand()->getCommandIdentifier())) { echo "This command must be executed during compiletime.\n"; } else { $objectManager->get('TYPO3\\FLOW3\\Mvc\\Dispatcher')->dispatch($request, $response); $response->send(); $this->emitDispatchedCommandLineSlaveRequest(); } echo "\nREADY\n"; } $systemLogger->log('Exiting sub process loop.', LOG_DEBUG); $this->bootstrap->shutdown('Runtime'); exit($response->getExitCode()); } catch (\Exception $exception) { $this->handleException($exception); } }
/** * Starts the shutdown sequence * * @param string $runlevel Either "Compiletime" or "Runtime" * @return void */ protected function shutdown($runlevel) { $this->bootstrap->shutdown($runlevel); if ($runlevel === 'Compiletime') { $this->objectManager->get('TYPO3\\FLOW3\\Core\\LockManager')->unlockSite(); } exit($this->response->getExitCode()); }
/** * Handles a HTTP request * * @return void */ public function handleRequest() { // Create the request very early so the Resource Management has a chance to grab it: $this->request = Request::createFromEnvironment(); $this->response = new Response(); $this->boot(); $this->resolveDependencies(); $this->request->injectSettings($this->settings); $this->router->setRoutesConfiguration($this->routesConfiguration); $actionRequest = $this->router->route($this->request); $this->securityContext->injectRequest($actionRequest); $this->dispatcher->dispatch($actionRequest, $this->response); $this->response->makeStandardsCompliant($this->request); $this->response->send(); $this->bootstrap->shutdown('Runtime'); $this->exit->__invoke(); }