public function getReport() { $content = ''; $solrConnections = $this->getConfiguredSolrConnections(); if (count($solrConnections) > 1) { $connectionMenu = $this->getSolrConnectionMenu($solrConnections); $this->injectSolrConnectionMenuIntoReportsModule($connectionMenu); } try { $this->solr = $this->getSelectedSolrConnection($solrConnections); $data = $this->solr->getLukeMetaData(); $content = $this->renderData($data); } catch (Exception $e) { $message = t3lib_div::makeInstance('t3lib_FlashMessage', 'Solr server: ' . $this->solr->getScheme() . '://' . $this->solr->getHost() . ':' . $this->solr->getPort() . $this->solr->getPath(), 'Failed to establish Solr connection.', t3lib_FlashMessage::ERROR, TRUE); $content = $message->render(); } return $content; }
/** * Checks whether a Solr server is available and provides some information. * * @param tx_solr_SolrService Solr connection * @return tx_reports_reports_status_Status Status of the Solr connection */ protected function getConnectionStatus(tx_solr_SolrService $solr) { $value = 'Your site was unable to contact the Apache Solr server.'; $severity = tx_reports_reports_status_Status::ERROR; $message = '<ul>' . '<li>Host: ' . $solr->getHost() . '</li>' . '<li>Port: ' . $solr->getPort() . '</li>' . '<li style="padding-bottom: 10px;">Path: ' . $solr->getPath() . '</li>'; if ($solr->ping()) { $severity = tx_reports_reports_status_Status::OK; $value = 'Your site has contacted the Apache Solr server.'; $solrVersion = $this->formatSolrVersion($solr->getSolrServerVersion()); $message .= '<li>Apache Solr: ' . $solrVersion . '</li>'; $message .= '<li>schema.xml: ' . $solr->getSchemaName() . '</li>'; $message .= '<li>solrconfig.xml: ' . $solr->getSolrconfigName() . '</li>'; $accessFilterPluginStatus = t3lib_div::makeInstance('tx_solr_report_AccessFilterPluginInstalledStatus'); $accessFilterPluginVersion = $accessFilterPluginStatus->getInstalledPluginVersion($solr); $message .= '<li>Access Filter Plugin: ' . $accessFilterPluginVersion . '</li>'; } $message .= '</ul>'; return t3lib_div::makeInstance('tx_reports_reports_status_Status', 'Apache Solr', $value, $message, $severity); }