/** * Runs a Yii controller. */ public function runController($route) { // run the controller parent::runController($route); // exit for some routes to prevent wordpress output foreach ($this->exitRoutes as $exitRoute) { if (strpos($route, $exitRoute) === 0) { Yii::app()->end(); } } }
/** * We were getting tons of errors in the logs from OPTIONS requests for the URI "*" * As it turns out, the requests were from localhost (::1) and are apparently a way * that Apache polls its processes to see if they're alive. This function causes * Yii to respond without logging errors. */ public function runController($route) { try { parent::runController($route); } catch (CHttpException $e) { if (@$_SERVER['REQUEST_METHOD'] == 'OPTIONS' && @$_SERVER['REQUEST_URI'] == '*') { Yii::app()->end('Hello, amigo!'); } else { throw $e; } } }
/** * Creates the controller and performs the specified action. * @param string $route the route of the current request. See {@link createController} for more details. * @throws CHttpException if the controller could not be created. */ public function runController($route) { try { parent::runController($route); } catch (CHttpException $x) { if (\Yii::app()->params['site']['logError404']) { \Yii::import('admin.models.BadUrlLog'); if (!\BadUrlLog::saveLog()) { throw $x; } // Si tout va bien, on enregistre l'erreur sans envoyer de mail à l'administrateur // On redirige le client vers la page d'erreur personnalisée \Yii::import('admin.*'); /** @var \AdminModule $adminModule */ $adminModule = \Yii::app()->getModule('admin'); $this->runController($adminModule->routeFor404ErrorPage); } else { throw $x; } } }