예제 #1
0
 protected function afterAction($action)
 {
     $time = sprintf('%0.5f', Yii::getLogger()->getExecutionTime());
     $memory = round(memory_get_peak_usage() / (1024 * 1024), 2) . "MB";
     echo '<!-- Time: ' . $time . 'ms, memory: ' . $memory . '-->';
     parent::afterAction($action);
 }
예제 #2
0
 protected function afterAction($action)
 {
     parent::afterAction($action);
     if (!$this->readOnly) {
         Yii::app()->unitOfWork->commit();
     }
 }
예제 #3
0
 public function afterAction($action)
 {
     ## Make sure service daemon is started
     if (!ServiceManager::checkDaemon()) {
         ServiceManager::startDaemon();
     }
     parent::afterAction($action);
     return true;
 }
예제 #4
0
 /**
  * @name  afterAction
  * @var $action
  * 
  */
 public function afterAction($action)
 {
     parent::afterAction($action);
     if (Yii::app()->params['statistik']) {
         if ('site.updatemsg' != $this->getId() . '.' . $action->id) {
             Yii::log($this->getTimeStamp() . '.' . $this->getId() . '.' . $action->id . ',' . Yii::app()->user->name . ',' . $_SERVER['REMOTE_ADDR'], 'info', 'statistik');
         }
     }
 }
예제 #5
0
 public function afterAction($action)
 {
     parent::afterAction($action);
 }
예제 #6
0
 public function afterAction($action)
 {
     if ($this->isActionAttachedByActionsMethod($action)) {
         return parent::afterAction($action);
     }
     $this->renderAndLogResponse();
     return parent::afterAction($action);
 }
예제 #7
0
 protected function afterAction($action)
 {
     $this->viewStatistic->run();
     parent::afterAction($action);
     // TODO: Change the autogenerated stub
 }
예제 #8
0
 /**
  * Checks request type and call response.
  *
  * @param $action
  */
 protected function afterAction($action)
 {
     if ($this->error == null && !$this->isFromCache) {
         if ($this->beforeToArray && is_callable($this->beforeToArray)) {
             call_user_func($this->beforeToArray, $this->data);
         }
         $this->toArray();
         if ($this->action instanceof IPostProcessable) {
             $this->action->postProcessing($this->data);
             if (is_array($this->data) && count($this->data) == 0) {
                 throw new NotFoundApiException();
             }
         }
         if ($this->requestType == 'Param') {
             \Yii::app()->apiCache->set($this->key, $this->data, self::CACHE_EXPIRE);
             $this->setModelCollectionCache();
             $this->setHeadersCache();
         }
     }
     if ($this->checkRequestType('GET') && $this->action instanceof IViewIncrementable) {
         if ($this->action->viewsIncrement() && $this->isFromCache) {
             \Yii::app()->apiCache->delete($this->key);
         }
     }
     //if data contains 1 element - returns object, not array. except get pagination request.
     /**@todo: bad idea, need refactor*/
     if (!$this->checkRequestType('GET') || \Yii::app()->request->getParam('id', null) || \Yii::app()->request->getParam('url', null)) {
         if ($this->error == null && $this->data != null && is_array($this->data) && count($this->data) == 1) {
             $this->data = $this->data[0];
         }
     }
     $this->complete();
     parent::afterAction($action);
 }
예제 #9
0
 /**
  * This method is invoked right after an action is executed.
  * You may override this method to do some postprocessing for the action.
  * @param CAction $action the action just executed.
  */
 protected function afterAction($action)
 {
     SourceBans::app()->trigger('app.afterAction', new CEvent($this, array('action' => $action)));
     parent::afterAction($action);
 }