public $defaultAction = 'api'; /** * @inheritdoc * @throws NotFoundHttpException */ public function beforeAction($action) { if (!Craft::$app->getConfig()->getGeneral()->enableGql) { throw new NotFoundHttpException(Craft::t('yii', 'Page not found.')); } Craft::$app->requireEdition(Craft::Pro); if ($action->id === 'api') { $this->enableCsrfValidation = false; } return parent::beforeAction($action);
break; } } $result = null; if ($runAction && $this->beforeAction($action)) { // run the action $result = $action->runWithParams($params); $result = $this->afterAction($action, $result); // call afterAction on modules
$parts = $this->createController($route); if (is_array($parts)) { /* @var $controller Controller */ list($controller, $actionID) = $parts; $oldController = Yii::$app->controller; Yii::$app->controller = $controller; $result = $controller->runAction($actionID, $params); if ($oldController !== null) { Yii::$app->controller = $oldController; } return $result; }
* @param string $route * @param array $params * @return Response|null The result of the action, normalized into a Response object */ public function runAction($route, $params = []) { $result = parent::runAction($route, $params); if ($result !== null) { if ($result instanceof Response) { return $result; }
$params = $this->catchAll; unset($params[0]); } try { Yii::debug("Route requested: '$route'", __METHOD__); $this->requestedRoute = $route; $result = $this->runAction($route, $params); if ($result instanceof Response) { return $result; } $response = $this->getResponse(); if ($result !== null) {
if (($response = $this->_processActionRequest($request)) !== null) { return $response; } // If we're still here, finally let Yii do it's thing. try { return parent::handleRequest($request); } catch (\Throwable $e) { $this->_unregisterDebugModule(); throw $e; } }
{ try { $this->state = self::STATE_BEFORE_REQUEST; $this->trigger(self::EVENT_BEFORE_REQUEST); $this->state = self::STATE_HANDLING_REQUEST; $response = $this->handleRequest($this->getRequest()); $this->state = self::STATE_AFTER_REQUEST; $this->trigger(self::EVENT_AFTER_REQUEST); $this->state = self::STATE_SENDING_RESPONSE; $response->send();
(new Dotenv\Dotenv(CRAFT_BASE_PATH))->load(); } // Load and run Craft define('CRAFT_ENVIRONMENT', getenv('ENVIRONMENT') ?: 'production'); $app = require CRAFT_VENDOR_PATH.'/craftcms/cms/bootstrap/web.php'; $app->run();
$_COOKIE = [ 'CRAFT_CSRF_TOKEN' => '62bc9b9909bfa748a9ca7eabce03f916fcb10816af7fd6d625f6720cd0fcbb1fa:2:{i:0;s:16:"CRAFT_CSRF_TOKEN";i:1;s:40:"_hpFpyLeWTEC88P2YIBFJAYIAaXbjVG3r1Mgak-k";}', 'CraftSessionId' => 'm7a2ufcrha4oo27j1hinpsrabi', ]; $_SESSION = [ 'bd62416aa8538ede709019a5e113eea5__flash' => [], ];