Exemple #1
0
 /**
  * Perform a search on messages and get the results
  *
  * @param  string     $query The query string
  * @return \Message[] The results of the search
  */
 public function search($query)
 {
     Debug::startStopwatch('search.messages');
     $results = $this->mysqlSearch($query);
     Debug::finishStopwatch('search.messages');
     return $results;
 }
Exemple #2
0
 /**
  * {@inheritDoc}
  *
  * @todo Error handling
  */
 public function trigger($channel, $message)
 {
     Debug::startStopwatch("notification.trigger.websocket");
     $port = \Service::getParameter('bzion.features.websocket.pull_port');
     $fp = @stream_socket_client("tcp://127.0.0.1:" . $port, $errno, $errstr, 1, STREAM_CLIENT_CONNECT | STREAM_CLIENT_PERSISTENT);
     @fwrite($fp, json_encode(array('event' => array('type' => $channel, 'data' => $message))) . "\n");
     // Don't fclose() the connection because of a weird bug with React
     Debug::finishStopwatch("notification.trigger.websocket");
 }
Exemple #3
0
 /**
  * Perform a search on messages and get the results
  *
  * @param  string    $query The query string
  * @return Message[] The results of the search
  */
 public function search($query)
 {
     Debug::startStopwatch('search.messages');
     if (\Service::getParameter('bzion.features.elasticsearch.enabled')) {
         $results = $this->elasticSearch($query);
     } else {
         $results = $this->mysqlSearch($query);
     }
     Debug::finishStopwatch('search.messages');
     return $results;
 }
Exemple #4
0
 /**
  * Renders a view
  * @param  string $view       The view name
  * @param  array  $parameters An array of parameters to pass to the view
  * @return string The rendered view
  */
 protected function render($view, $parameters = array())
 {
     Debug::startStopwatch('view.render');
     $template = Service::getTemplateEngine();
     $ret = $template->render($view, $parameters);
     Debug::finishStopwatch('view.render');
     return $ret;
 }
Exemple #5
0
 /**
  * Renders a view
  * @param  string $view       The view name
  * @param  array  $parameters An array of parameters to pass to the view
  * @return string The rendered view
  */
 protected function render($view, $parameters = array())
 {
     Debug::startStopwatch('view.render');
     $ret = $this->container->get('twig')->render($view, $parameters);
     Debug::finishStopwatch('view.render');
     return $ret;
 }