Пример #1
0
 public function postDispatch()
 {
     parent::postDispatch();
     $end_time = microtime(true);
     $request_time = $end_time - $this->_time_start;
     // Log request using a raw SQL query for higher performance.
     if (isset($_SERVER['CF-Connecting-IP'])) {
         $remote_ip = $_SERVER['CF-Connecting-IP'];
     } else {
         $remote_ip = $_SERVER['REMOTE_ADDR'];
     }
     $params = array_merge((array) $this->dispatcher->getParams(), (array) $this->request->getQuery());
     // Insert into Influx
     $influx = $this->di->get('influx');
     $influx->setDatabase('pvlive_analytics');
     $influx->insert('api_calls', ['value' => 1, 'ip' => $remote_ip, 'client' => $this->getParam('client', 'general'), 'useragent' => $_SERVER['HTTP_USER_AGENT'], 'controller' => $this->dispatcher->getControllerName() . '/' . $this->dispatcher->getActionName(), 'parameters' => json_encode($params), 'referrer' => $_SERVER['HTTP_REFERER'], 'is_ajax' => $this->isAjax() ? '1' : '0', 'requesttime' => $request_time]);
 }
Пример #2
0
 protected function preDispatch()
 {
     parent::preDispatch();
     return true;
 }
Пример #3
0
 protected function preDispatch()
 {
     parent::preDispatch();
     $this->forceSecure();
     return true;
 }