/**
  * @inheritdoc
  */
 public function afterAction($action, $result)
 {
     if ($this->_oldMailPath !== null) {
         Yii::$app->getMailer()->setViewPath($this->_oldMailPath);
     }
     return parent::afterAction($action, $result);
 }
Example #2
0
 public function afterAction($action, $result)
 {
     if (self::$isStatistic) {
         (new Query())->createCommand()->insert('timer', ['action_id' => $action->id, 'controller_id' => $this->id, 'date_time' => gmdate('YmdHis'), 'timer' => microtime(true) - $this->markDownCounter])->execute();
     }
     return parent::afterAction($action, $result);
 }
Example #3
0
 /**
  * @param \yii\base\Action $action
  * @param mixed $result
  * @return mixed
  */
 public function afterAction($action, $result)
 {
     if ($this->session->isActive) {
         $this->session->close();
     }
     return parent::afterAction($action, $result);
 }
Example #4
0
 public function afterAction($action, $result)
 {
     echo 'before action<br>';
     echo 'test<br>';
     return parent::afterAction($action, $result);
     // TODO: Change the autogenerated stub
 }
Example #5
0
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     if ($action->id != 'error' && Extension_Loaded('zlib')) {
         Ob_End_Flush();
     }
     return $result;
 }
 public function afterAction($action, $result)
 {
     parent::afterAction($action, $result);
     if (Yii::$app->response->format == Response::FORMAT_JSON) {
         header('Content-Type: application/json');
         return $this->ajaxResponse;
     }
     return null;
 }
Example #7
0
 /**
  * @inheritdoc
  */
 public function afterAction($action, $result)
 {
     // save log
     $log = new models\api\Log();
     $log->status = models\api\Log::STATUS_SUCCESS;
     $log->save();
     // generate answer
     $data = ['status' => models\api\Log::STATUS_SUCCESS, 'data' => $result];
     return parent::afterAction($action, $data);
 }
Example #8
0
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     // your custom code here
     $obResult = ob_get_clean();
     if (!empty($obResult)) {
         // 所有actionXxx中 如果出现 echo print dump 等向缓存输出内容的调用 将走此逻辑
         return $this->renderContent($obResult);
         // return $obResult ;
     }
     return $result;
 }
 /**
  * Executed after action
  * @author Adegoke Obasa <*****@*****.**>
  * @param \yii\base\Action $action
  * @param mixed $result
  * @return mixed
  */
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     $this->setSecurityHeaders();
     /**
      * Set Current Transaction in New Relic
      * @author Adegoke Obasa <*****@*****.**>
      */
     if (extension_loaded('newrelic')) {
         newrelic_name_transaction($action->controller->id . '/' . $action->id);
     }
     return $result;
 }
Example #10
0
 /**
  * @inheritdoc
  */
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     if ($result) {
         return $result;
     }
     $session = Yii::$app->session;
     if ($session->isActive) {
         $session->close();
     }
     $this->view->registerAssetBundle($this->assetName);
     $this->data('tpl', $this->_tpl . '.tpl');
     $this->forceSetTitle();
     return $this->renderPartial('@app/views/index.tpl', $this->_data);
 }
Example #11
0
 public function afterAction($action, $result)
 {
     /**
      * @var $user \common\models\User
      */
     if (!\Yii::$app->user->isGuest) {
         $user = \Yii::$app->user->identity;
         // если у пользователя изменили данные и не сохранили, то сохраняем,
         // один из вариантов обновления без сохранения смотреть в методе чуть выше beforeAction
         if ($user->getDirtyAttributes()) {
             $user->update();
         }
     }
     return parent::afterAction($action, $result);
     // TODO: Change the autogenerated stub
 }
 public function afterAction($action, $result)
 {
     $errorHandler = Yii::$app->get('errorHandler');
     if (!empty($errorHandler->exception)) {
         $this->handleException($errorHandler->exception);
     }
     $result = parent::afterAction($action, $result);
     if ($this->response->getStatusCode() == 200) {
         return $this->respondByFormat();
     }
     return $result;
 }
Example #13
0
 public function afterAction($action, $result)
 {
     U::W("{$this->id}/{$this->action->id}:" . Yii::getLogger()->getElapsedTime());
     return parent::afterAction($action, $result);
 }
 /**
  * @inheritdoc
  */
 public function afterAction($action, $result)
 {
     \Yii::endProfile('jsonrpc.controller.' . $action->id);
     return parent::afterAction($action, $result);
 }
Example #15
0
 /**
  * @inheritdoc
  */
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     return $this->serializeData($result);
 }
 public function afterAction($action, $result)
 {
     return parent::afterAction($action, $result);
 }
Example #17
0
 public function afterAction($action, $result)
 {
     if (Response::FORMAT_JSON == $this->format) {
         $response = Yii::$app->response;
         $response->format = Response::FORMAT_JSON;
         $response->data = $result;
     }
     return parent::afterAction($action, $result);
 }
Example #18
0
 /**
  * @inheritdoc
  */
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     return ['sort' => ['errors' => !empty($result)]];
 }
Example #19
0
 public function afterAction($action, $result)
 {
     return parent::afterAction($action, $result);
     // TODO: Change the autogenerated stub
 }
Example #20
0
 public function afterAction($action, $result)
 {
     Yii::$app->getUser()->setReturnUrl(Yii::$app->request->url);
     return parent::afterAction($action, $result);
 }
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     if ($this->response->getStatusCode() == 200) {
         return $this->respondByFormat();
     }
     return $result;
 }
 public function afterAction($action, $result)
 {
     $result = parent::afterAction($action, $result);
     return $result;
 }
Example #23
-1
 public function afterAction($action, $result)
 {
     if (!Yii::$app->user->isGuest) {
         $actionName = "frontend@{$this->module->id}_{$this->id}_{$action->id}";
     }
     return parent::afterAction($action, $result);
 }
 public function afterAction($action, $result)
 {
     if (Yii::$app->request->pathInfo !== "auth/index") {
         Url::remember(Url::toRoute(["/" . Yii::$app->request->pathInfo]), 'safe_url');
     }
     return parent::afterAction($action, $result);
 }