Ejemplo n.º 1
0
 /**
  * Display the overview
  */
 public function displayTask()
 {
     foreach ($this->getErrors() as $error) {
         $this->view->setError($error);
     }
     // Instantiate Search class
     $config = Component::params('com_search');
     // Get the last insert date
     try {
         $index = new \Hubzero\Search\Index($config);
         $timestamp = $insertTime = $index->lastInsert();
         $insertTime = Date::of($timestamp)->format('relative');
         $status = $index->status();
         // Get the last 10 entries
         $logs = array_slice($index->getLogs(), -10, 10, true);
     } catch (\Solarium\Exception\HttpException $e) {
         $this->view->setError($e->getMessage());
         $insertTime = '';
         $status = 'failed';
         $logs = array();
     }
     // Get queue status
     $this->view->queueStats = SolrHelper::queueStatus();
     $this->view->mechanism = $config->get('engine');
     $this->view->status = $status;
     $this->view->logs = $logs;
     $this->view->lastInsert = $insertTime;
     $this->view->setLayout('overview');
     // Display the view
     $this->view->display();
 }