first commit
This commit is contained in:
@@ -29,11 +29,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Reports\StatusProviderInterface;
|
||||
|
||||
/**
|
||||
* Provides shared functionality for all Solr reports.
|
||||
* Provides shared functionality for all Meilisearch reports.
|
||||
*
|
||||
* @author Timo Hund <timo.hund@dkd.de>
|
||||
*/
|
||||
abstract class AbstractSolrStatus implements StatusProviderInterface
|
||||
abstract class AbstractMeilisearchStatus implements StatusProviderInterface
|
||||
{
|
||||
/**
|
||||
* Assigns variables to the fluid StandaloneView and renders the view.
|
@@ -25,21 +25,21 @@ namespace WapplerSystems\Meilisearch\Report;
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Service\SolrAdminService;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Service\MeilisearchAdminService;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Reports\Status;
|
||||
|
||||
/**
|
||||
* Provides a status report about whether the Access Filter Query Parser Plugin
|
||||
* is installed on the Solr server.
|
||||
* is installed on the Meilisearch server.
|
||||
*
|
||||
* @author Ingo Renner <ingo@typo3.org>
|
||||
*/
|
||||
class AccessFilterPluginInstalledStatus extends AbstractSolrStatus
|
||||
class AccessFilterPluginInstalledStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
|
||||
/**
|
||||
* Solr Access Filter plugin version.
|
||||
* Meilisearch Access Filter plugin version.
|
||||
*
|
||||
* Must be updated when changing the plugin.
|
||||
*
|
||||
@@ -52,21 +52,21 @@ class AccessFilterPluginInstalledStatus extends AbstractSolrStatus
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const PLUGIN_CLASS_NAME = 'org.typo3.solr.search.AccessFilterQParserPlugin';
|
||||
const PLUGIN_CLASS_NAME = 'org.typo3.meilisearch.search.AccessFilterQParserPlugin';
|
||||
|
||||
/**
|
||||
* Compiles a collection of solrconfig.xml checks against each configured
|
||||
* Solr server. Only adds an entry if the Access Filter Query Parser Plugin
|
||||
* Compiles a collection of meilisearchconfig.xml checks against each configured
|
||||
* Meilisearch server. Only adds an entry if the Access Filter Query Parser Plugin
|
||||
* is not configured.
|
||||
*
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$reports = [];
|
||||
$solrConnections = GeneralUtility::makeInstance(ConnectionManager::class)->getAllConnections();
|
||||
$meilisearchConnections = GeneralUtility::makeInstance(ConnectionManager::class)->getAllConnections();
|
||||
|
||||
foreach ($solrConnections as $solrConnection) {
|
||||
$adminService = $solrConnection->getAdminService();
|
||||
foreach ($meilisearchConnections as $meilisearchConnection) {
|
||||
$adminService = $meilisearchConnection->getAdminService();
|
||||
if ($adminService->ping()) {
|
||||
$installationStatus = $this->checkPluginInstallationStatus($adminService);
|
||||
$versionStatus = $this->checkPluginVersion($adminService);
|
||||
@@ -85,18 +85,18 @@ class AccessFilterPluginInstalledStatus extends AbstractSolrStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the Solr plugin is installed.
|
||||
* Checks whether the Meilisearch plugin is installed.
|
||||
*
|
||||
* @param SolrAdminService $adminService
|
||||
* @param MeilisearchAdminService $adminService
|
||||
* @return null|\TYPO3\CMS\Reports\Status
|
||||
*/
|
||||
protected function checkPluginInstallationStatus(SolrAdminService $adminService)
|
||||
protected function checkPluginInstallationStatus(MeilisearchAdminService $adminService)
|
||||
{
|
||||
if ($this->isPluginInstalled($adminService)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$variables = ['solr' => $adminService, 'recommendedVersion' => self::RECOMMENDED_PLUGIN_VERSION];
|
||||
$variables = ['meilisearch' => $adminService, 'recommendedVersion' => self::RECOMMENDED_PLUGIN_VERSION];
|
||||
|
||||
$report = $this->getRenderedReport('AccessFilterPluginInstalledStatusNotInstalled.html', $variables);
|
||||
return GeneralUtility::makeInstance(
|
||||
@@ -109,19 +109,19 @@ class AccessFilterPluginInstalledStatus extends AbstractSolrStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the Solr plugin version is up to date.
|
||||
* Checks whether the Meilisearch plugin version is up to date.
|
||||
*
|
||||
* @param SolrAdminService $adminService
|
||||
* @param MeilisearchAdminService $adminService
|
||||
* @return null|\TYPO3\CMS\Reports\Status
|
||||
*/
|
||||
protected function checkPluginVersion(SolrAdminService $adminService)
|
||||
protected function checkPluginVersion(MeilisearchAdminService $adminService)
|
||||
{
|
||||
if (!($this->isPluginInstalled($adminService) && $this->isPluginOutdated($adminService))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$version = $this->getInstalledPluginVersion($adminService);
|
||||
$variables = ['solr' => $adminService, 'installedVersion' => $version, 'recommendedVersion' => self::RECOMMENDED_PLUGIN_VERSION];
|
||||
$variables = ['meilisearch' => $adminService, 'installedVersion' => $version, 'recommendedVersion' => self::RECOMMENDED_PLUGIN_VERSION];
|
||||
$report = $this->getRenderedReport('AccessFilterPluginInstalledStatusIsOutDated.html', $variables);
|
||||
|
||||
return GeneralUtility::makeInstance(
|
||||
@@ -135,12 +135,12 @@ class AccessFilterPluginInstalledStatus extends AbstractSolrStatus
|
||||
|
||||
/**
|
||||
* Checks whether the Access Filter Query Parser Plugin is installed for
|
||||
* the given Solr server instance.
|
||||
* the given Meilisearch server instance.
|
||||
*
|
||||
* @param SolrAdminService $adminService
|
||||
* @param MeilisearchAdminService $adminService
|
||||
* @return bool True if the plugin is installed, FALSE otherwise.
|
||||
*/
|
||||
protected function isPluginInstalled(SolrAdminService $adminService)
|
||||
protected function isPluginInstalled(MeilisearchAdminService $adminService)
|
||||
{
|
||||
$accessFilterQueryParserPluginInstalled = false;
|
||||
|
||||
@@ -155,10 +155,10 @@ class AccessFilterPluginInstalledStatus extends AbstractSolrStatus
|
||||
/**
|
||||
* Checks whether the installed plugin is current.
|
||||
*
|
||||
* @param SolrAdminService $adminService
|
||||
* @param MeilisearchAdminService $adminService
|
||||
* @return bool True if the plugin is outdated, FALSE if it meets the current version recommendation.
|
||||
*/
|
||||
protected function isPluginOutdated(SolrAdminService $adminService)
|
||||
protected function isPluginOutdated(MeilisearchAdminService $adminService)
|
||||
{
|
||||
$pluginVersion = $this->getInstalledPluginVersion($adminService);
|
||||
$pluginVersionOutdated = version_compare($pluginVersion, self::RECOMMENDED_PLUGIN_VERSION, '<');
|
||||
@@ -169,10 +169,10 @@ class AccessFilterPluginInstalledStatus extends AbstractSolrStatus
|
||||
/**
|
||||
* Gets the version of the installed plugin.
|
||||
*
|
||||
* @param SolrAdminService $adminService
|
||||
* @param MeilisearchAdminService $adminService
|
||||
* @return string The installed plugin's version number.
|
||||
*/
|
||||
public function getInstalledPluginVersion(SolrAdminService $adminService)
|
||||
public function getInstalledPluginVersion(MeilisearchAdminService $adminService)
|
||||
{
|
||||
$pluginsInformation = $adminService->getPluginsInformation();
|
||||
|
||||
|
@@ -33,7 +33,7 @@ use TYPO3\CMS\Reports\Status;
|
||||
*
|
||||
* @author Ingo Renner <ingo@typo3.org>
|
||||
*/
|
||||
class AllowUrlFOpenStatus extends AbstractSolrStatus
|
||||
class AllowUrlFOpenStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ class AllowUrlFOpenStatus extends AbstractSolrStatus
|
||||
$severity = Status::ERROR;
|
||||
$value = 'Off';
|
||||
$message = 'allow_url_fopen must be enabled in php.ini to allow
|
||||
communication between TYPO3 and the Apache Solr server.
|
||||
communication between TYPO3 and the Meilisearch server.
|
||||
Indexing pages using the Index Queue will also not work with
|
||||
this setting disabled.';
|
||||
}
|
||||
|
@@ -33,7 +33,7 @@ use TYPO3\CMS\Reports\Status;
|
||||
*
|
||||
* @author Ingo Renner <ingo@typo3.org>
|
||||
*/
|
||||
class FilterVarStatus extends AbstractSolrStatus
|
||||
class FilterVarStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -44,7 +44,7 @@ class FilterVarStatus extends AbstractSolrStatus
|
||||
{
|
||||
$reports = [];
|
||||
|
||||
$validUrl = 'http://www.typo3-solr.com';
|
||||
$validUrl = 'http://www.typo3-meilisearch.com';
|
||||
if (!filter_var($validUrl, FILTER_VALIDATE_URL)) {
|
||||
$message = 'You are using a PHP version that is affected by a bug in
|
||||
function filter_var(). This bug causes said function to
|
||||
|
@@ -29,12 +29,12 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Reports\Status;
|
||||
|
||||
/**
|
||||
* Provides a status report about which solrconfig version is used and checks
|
||||
* Provides a status report about which meilisearchconfig version is used and checks
|
||||
* whether it fits the recommended version shipping with the extension.
|
||||
*
|
||||
* @author Ingo Renner <ingo@typo3.org>
|
||||
*/
|
||||
class SolrConfigStatus extends AbstractSolrStatus
|
||||
class MeilisearchConfigStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -44,33 +44,33 @@ class SolrConfigStatus extends AbstractSolrStatus
|
||||
* x-y-z - The extension version this config is meant to work with
|
||||
* YYYYMMDD - The date the config file was changed the last time
|
||||
*
|
||||
* Must be updated when changing the solrconfig.
|
||||
* Must be updated when changing the meilisearchconfig.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const RECOMMENDED_SOLRCONFIG_VERSION = 'tx_meilisearch-11-0-0--20200415';
|
||||
|
||||
/**
|
||||
* Compiles a collection of solrconfig version checks against each configured
|
||||
* Solr server. Only adds an entry if a solrconfig other than the
|
||||
* Compiles a collection of meilisearchconfig version checks against each configured
|
||||
* Meilisearch server. Only adds an entry if a meilisearchconfig other than the
|
||||
* recommended one was found.
|
||||
*
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$reports = [];
|
||||
$solrConnections = GeneralUtility::makeInstance(ConnectionManager::class)->getAllConnections();
|
||||
$meilisearchConnections = GeneralUtility::makeInstance(ConnectionManager::class)->getAllConnections();
|
||||
|
||||
foreach ($solrConnections as $solrConnection) {
|
||||
$adminService = $solrConnection->getAdminService();
|
||||
foreach ($meilisearchConnections as $meilisearchConnection) {
|
||||
$adminService = $meilisearchConnection->getAdminService();
|
||||
|
||||
if ($adminService->ping() && $adminService->getSolrconfigName() != self::RECOMMENDED_SOLRCONFIG_VERSION) {
|
||||
$variables = ['solr' => $adminService, 'recommendedVersion' => self::RECOMMENDED_SOLRCONFIG_VERSION];
|
||||
$report = $this->getRenderedReport('SolrConfigStatus.html', $variables);
|
||||
if ($adminService->ping() && $adminService->getMeilisearchconfigName() != self::RECOMMENDED_SOLRCONFIG_VERSION) {
|
||||
$variables = ['meilisearch' => $adminService, 'recommendedVersion' => self::RECOMMENDED_SOLRCONFIG_VERSION];
|
||||
$report = $this->getRenderedReport('MeilisearchConfigStatus.html', $variables);
|
||||
$status = GeneralUtility::makeInstance(
|
||||
Status::class,
|
||||
/** @scrutinizer ignore-type */ 'Solrconfig Version',
|
||||
/** @scrutinizer ignore-type */ 'Unsupported solrconfig.xml',
|
||||
/** @scrutinizer ignore-type */ 'Meilisearchconfig Version',
|
||||
/** @scrutinizer ignore-type */ 'Unsupported meilisearchconfig.xml',
|
||||
/** @scrutinizer ignore-type */ $report,
|
||||
/** @scrutinizer ignore-type */ Status::WARNING
|
||||
);
|
@@ -40,7 +40,7 @@ use TYPO3\CMS\Reports\Status;
|
||||
*
|
||||
* @author Ingo Renner <ingo@typo3.org>
|
||||
*/
|
||||
class SolrConfigurationStatus extends AbstractSolrStatus
|
||||
class MeilisearchConfigurationStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
/**
|
||||
* @var ExtensionConfiguration
|
||||
@@ -53,7 +53,7 @@ class SolrConfigurationStatus extends AbstractSolrStatus
|
||||
protected $frontendEnvironment = null;
|
||||
|
||||
/**
|
||||
* SolrConfigurationStatus constructor.
|
||||
* MeilisearchConfigurationStatus constructor.
|
||||
* @param ExtensionConfiguration|null $extensionConfiguration
|
||||
* @param FrontendEnvironment|null $frontendEnvironment
|
||||
|
||||
@@ -130,7 +130,7 @@ class SolrConfigurationStatus extends AbstractSolrStatus
|
||||
return null;
|
||||
}
|
||||
|
||||
$report = $this->getRenderedReport('SolrConfigurationStatusIndexing.html', ['pages' => $rootPagesWithIndexingOff]);
|
||||
$report = $this->getRenderedReport('MeilisearchConfigurationStatusIndexing.html', ['pages' => $rootPagesWithIndexingOff]);
|
||||
return GeneralUtility::makeInstance(
|
||||
Status::class,
|
||||
/** @scrutinizer ignore-type */ 'Page Indexing',
|
||||
@@ -154,8 +154,8 @@ class SolrConfigurationStatus extends AbstractSolrStatus
|
||||
foreach ($rootPages as $rootPage) {
|
||||
try {
|
||||
$this->initializeTSFE($rootPage);
|
||||
$solrIsEnabledAndIndexingDisabled = $this->getIsSolrEnabled() && !$this->getIsIndexingEnabled();
|
||||
if ($solrIsEnabledAndIndexingDisabled) {
|
||||
$meilisearchIsEnabledAndIndexingDisabled = $this->getIsMeilisearchEnabled() && !$this->getIsIndexingEnabled();
|
||||
if ($meilisearchIsEnabledAndIndexingDisabled) {
|
||||
$rootPagesWithIndexingOff[] = $rootPage;
|
||||
}
|
||||
} catch (RuntimeException $rte) {
|
||||
@@ -192,11 +192,11 @@ class SolrConfigurationStatus extends AbstractSolrStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the solr plugin is enabled with plugin.tx_meilisearch.enabled.
|
||||
* Checks if the meilisearch plugin is enabled with plugin.tx_meilisearch.enabled.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function getIsSolrEnabled(): bool
|
||||
protected function getIsMeilisearchEnabled(): bool
|
||||
{
|
||||
if (empty($GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_meilisearch.']['enabled'])) {
|
||||
return false;
|
@@ -27,19 +27,19 @@ namespace WapplerSystems\Meilisearch\Report;
|
||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
||||
use WapplerSystems\Meilisearch\PingFailedException;
|
||||
use WapplerSystems\Meilisearch\System\Solr\Service\SolrAdminService;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\Service\MeilisearchAdminService;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Fluid\View\StandaloneView;
|
||||
use TYPO3\CMS\Reports\Status;
|
||||
use TYPO3\CMS\Reports\StatusProviderInterface;
|
||||
|
||||
/**
|
||||
* Provides an status report about whether a connection to the Solr server can
|
||||
* Provides an status report about whether a connection to the Meilisearch server can
|
||||
* be established.
|
||||
*
|
||||
* @author Ingo Renner <ingo@typo3.org>
|
||||
*/
|
||||
class SolrStatus extends AbstractSolrStatus
|
||||
class MeilisearchStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -72,7 +72,7 @@ class SolrStatus extends AbstractSolrStatus
|
||||
|
||||
|
||||
/**
|
||||
* SolrStatus constructor.
|
||||
* MeilisearchStatus constructor.
|
||||
* @param SiteRepository|null $siteRepository
|
||||
* @param ConnectionManager|null $connectionManager
|
||||
*/
|
||||
@@ -83,15 +83,15 @@ class SolrStatus extends AbstractSolrStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* Compiles a collection of status checks against each configured Solr server.
|
||||
* Compiles a collection of status checks against each configured Meilisearch server.
|
||||
*
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$reports = [];
|
||||
foreach ($this->siteRepository->getAvailableSites() as $site) {
|
||||
foreach ($site->getAllSolrConnectionConfigurations() as $solrConfiguration) {
|
||||
$reports[] = $this->getConnectionStatus($solrConfiguration);
|
||||
foreach ($site->getAllMeilisearchConnectionConfigurations() as $meilisearchConfiguration) {
|
||||
$reports[] = $this->getConnectionStatus($meilisearchConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,45 +99,45 @@ class SolrStatus extends AbstractSolrStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a Solr server is available and provides some information.
|
||||
* Checks whether a Meilisearch server is available and provides some information.
|
||||
*
|
||||
* @param array $solrConnection Solr connection parameters
|
||||
* @return Status Status of the Solr connection
|
||||
* @param array $meilisearchConnection Meilisearch connection parameters
|
||||
* @return Status Status of the Meilisearch connection
|
||||
*/
|
||||
protected function getConnectionStatus(array $solrConnection)
|
||||
protected function getConnectionStatus(array $meilisearchConnection)
|
||||
{
|
||||
$header = 'Your site has contacted the Apache Solr server.';
|
||||
$header = 'Your site has contacted the Meilisearch server.';
|
||||
$this->responseStatus = Status::OK;
|
||||
|
||||
$solrAdmin = $this->connectionManager
|
||||
->getSolrConnectionForNodes($solrConnection['read'], $solrConnection['write'])
|
||||
$meilisearchAdmin = $this->connectionManager
|
||||
->getMeilisearchConnectionForNodes($meilisearchConnection['read'], $meilisearchConnection['write'])
|
||||
->getAdminService();
|
||||
|
||||
$solrVersion = $this->checkSolrVersion($solrAdmin);
|
||||
$accessFilter = $this->checkAccessFilter($solrAdmin);
|
||||
$pingTime = $this->checkPingTime($solrAdmin);
|
||||
$configName = $this->checkSolrConfigName($solrAdmin);
|
||||
$schemaName = $this->checkSolrSchemaName($solrAdmin);
|
||||
$meilisearchVersion = $this->checkMeilisearchVersion($meilisearchAdmin);
|
||||
$accessFilter = $this->checkAccessFilter($meilisearchAdmin);
|
||||
$pingTime = $this->checkPingTime($meilisearchAdmin);
|
||||
$configName = $this->checkMeilisearchConfigName($meilisearchAdmin);
|
||||
$schemaName = $this->checkMeilisearchSchemaName($meilisearchAdmin);
|
||||
|
||||
if ($this->responseStatus !== Status::OK) {
|
||||
$header = 'Failed contacting the Solr server.';
|
||||
$header = 'Failed contacting the Meilisearch server.';
|
||||
}
|
||||
|
||||
$variables = [
|
||||
'header' => $header,
|
||||
'connection' => $solrConnection,
|
||||
'solr' => $solrAdmin,
|
||||
'solrVersion' => $solrVersion,
|
||||
'connection' => $meilisearchConnection,
|
||||
'meilisearch' => $meilisearchAdmin,
|
||||
'meilisearchVersion' => $meilisearchVersion,
|
||||
'pingTime' => $pingTime,
|
||||
'configName' => $configName,
|
||||
'schemaName' => $schemaName,
|
||||
'accessFilter' => $accessFilter
|
||||
];
|
||||
|
||||
$report = $this->getRenderedReport('SolrStatus.html', $variables);
|
||||
$report = $this->getRenderedReport('MeilisearchStatus.html', $variables);
|
||||
return GeneralUtility::makeInstance(
|
||||
Status::class,
|
||||
/** @scrutinizer ignore-type */ 'Apache Solr',
|
||||
/** @scrutinizer ignore-type */ 'Meilisearch',
|
||||
/** @scrutinizer ignore-type */ '',
|
||||
/** @scrutinizer ignore-type */ $report,
|
||||
/** @scrutinizer ignore-type */ $this->responseStatus
|
||||
@@ -145,34 +145,34 @@ class SolrStatus extends AbstractSolrStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the solr version and adds it to the report.
|
||||
* Checks the meilisearch version and adds it to the report.
|
||||
*
|
||||
* @param SolrAdminService $solr
|
||||
* @return string solr version
|
||||
* @param MeilisearchAdminService $meilisearch
|
||||
* @return string meilisearch version
|
||||
*/
|
||||
protected function checkSolrVersion(SolrAdminService $solr)
|
||||
protected function checkMeilisearchVersion(MeilisearchAdminService $meilisearch)
|
||||
{
|
||||
try {
|
||||
$solrVersion = $this->formatSolrVersion($solr->getSolrServerVersion());
|
||||
$meilisearchVersion = $this->formatMeilisearchVersion($meilisearch->getMeilisearchServerVersion());
|
||||
} catch (\Exception $e) {
|
||||
$this->responseStatus = Status::ERROR;
|
||||
$solrVersion = 'Error getting solr version: ' . $e->getMessage();
|
||||
$meilisearchVersion = 'Error getting meilisearch version: ' . $e->getMessage();
|
||||
}
|
||||
|
||||
return $solrVersion;
|
||||
return $meilisearchVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the access filter setup and adds it to the report.
|
||||
*
|
||||
* @param SolrAdminService $solrAdminService
|
||||
* @param MeilisearchAdminService $meilisearchAdminService
|
||||
* @return string
|
||||
*/
|
||||
protected function checkAccessFilter(SolrAdminService $solrAdminService)
|
||||
protected function checkAccessFilter(MeilisearchAdminService $meilisearchAdminService)
|
||||
{
|
||||
try {
|
||||
$accessFilterPluginStatus = GeneralUtility::makeInstance(AccessFilterPluginInstalledStatus::class);
|
||||
$accessFilterPluginVersion = $accessFilterPluginStatus->getInstalledPluginVersion($solrAdminService);
|
||||
$accessFilterPluginVersion = $accessFilterPluginStatus->getInstalledPluginVersion($meilisearchAdminService);
|
||||
$accessFilterMessage = $accessFilterPluginVersion;
|
||||
} catch (\Exception $e) {
|
||||
$this->responseStatus = Status::ERROR;
|
||||
@@ -184,13 +184,13 @@ class SolrStatus extends AbstractSolrStatus
|
||||
/**
|
||||
* Checks the ping time and adds it to the report.
|
||||
*
|
||||
* @param SolrAdminService $solrAdminService
|
||||
* @param MeilisearchAdminService $meilisearchAdminService
|
||||
* @return string
|
||||
*/
|
||||
protected function checkPingTime(SolrAdminService $solrAdminService)
|
||||
protected function checkPingTime(MeilisearchAdminService $meilisearchAdminService)
|
||||
{
|
||||
try {
|
||||
$pingQueryTime = $solrAdminService->getPingRoundTripRuntime();
|
||||
$pingQueryTime = $meilisearchAdminService->getPingRoundTripRuntime();
|
||||
$pingMessage = (int)$pingQueryTime . ' ms';
|
||||
} catch (PingFailedException $e) {
|
||||
$this->responseStatus = Status::ERROR;
|
||||
@@ -200,64 +200,64 @@ class SolrStatus extends AbstractSolrStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the solr config name and adds it to the report.
|
||||
* Checks the meilisearch config name and adds it to the report.
|
||||
*
|
||||
* @param SolrAdminService $solrAdminService
|
||||
* @param MeilisearchAdminService $meilisearchAdminService
|
||||
* @return string
|
||||
*/
|
||||
protected function checkSolrConfigName(SolrAdminService $solrAdminService)
|
||||
protected function checkMeilisearchConfigName(MeilisearchAdminService $meilisearchAdminService)
|
||||
{
|
||||
try {
|
||||
$solrConfigMessage = $solrAdminService->getSolrconfigName();
|
||||
$meilisearchConfigMessage = $meilisearchAdminService->getMeilisearchconfigName();
|
||||
} catch (\Exception $e) {
|
||||
$this->responseStatus = Status::ERROR;
|
||||
$solrConfigMessage = 'Error determining solr config: ' . $e->getMessage();
|
||||
$meilisearchConfigMessage = 'Error determining meilisearch config: ' . $e->getMessage();
|
||||
}
|
||||
|
||||
return $solrConfigMessage;
|
||||
return $meilisearchConfigMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the solr schema name and adds it to the report.
|
||||
* Checks the meilisearch schema name and adds it to the report.
|
||||
*
|
||||
* @param SolrAdminService $solrAdminService
|
||||
* @param MeilisearchAdminService $meilisearchAdminService
|
||||
* @return string
|
||||
*/
|
||||
protected function checkSolrSchemaName(SolrAdminService $solrAdminService)
|
||||
protected function checkMeilisearchSchemaName(MeilisearchAdminService $meilisearchAdminService)
|
||||
{
|
||||
try {
|
||||
$solrSchemaMessage = $solrAdminService->getSchema()->getName();
|
||||
$meilisearchSchemaMessage = $meilisearchAdminService->getSchema()->getName();
|
||||
} catch (\Exception $e) {
|
||||
$this->responseStatus = Status::ERROR;
|
||||
$solrSchemaMessage = 'Error determining schema name: ' . $e->getMessage();
|
||||
$meilisearchSchemaMessage = 'Error determining schema name: ' . $e->getMessage();
|
||||
}
|
||||
|
||||
return $solrSchemaMessage;
|
||||
return $meilisearchSchemaMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the Apache Solr server version number. By default this is going
|
||||
* Formats the Meilisearch server version number. By default this is going
|
||||
* to be the simple major.minor.patch-level version. Custom Builds provide
|
||||
* more information though, in case of custom builds, their complete
|
||||
* version will be added, too.
|
||||
*
|
||||
* @param string $solrVersion Unformatted Apache Solr version number as provided by Solr.
|
||||
* @param string $meilisearchVersion Unformatted Meilisearch version number as provided by Meilisearch.
|
||||
* @return string formatted short version number, in case of custom builds followed by the complete version number
|
||||
*/
|
||||
protected function formatSolrVersion($solrVersion)
|
||||
protected function formatMeilisearchVersion($meilisearchVersion)
|
||||
{
|
||||
$explodedSolrVersion = explode('.', $solrVersion);
|
||||
$explodedMeilisearchVersion = explode('.', $meilisearchVersion);
|
||||
|
||||
$shortSolrVersion = $explodedSolrVersion[0]
|
||||
. '.' . $explodedSolrVersion[1]
|
||||
. '.' . $explodedSolrVersion[2];
|
||||
$shortMeilisearchVersion = $explodedMeilisearchVersion[0]
|
||||
. '.' . $explodedMeilisearchVersion[1]
|
||||
. '.' . $explodedMeilisearchVersion[2];
|
||||
|
||||
$formattedSolrVersion = $shortSolrVersion;
|
||||
$formattedMeilisearchVersion = $shortMeilisearchVersion;
|
||||
|
||||
if ($solrVersion != $shortSolrVersion) {
|
||||
$formattedSolrVersion .= ' (' . $solrVersion . ')';
|
||||
if ($meilisearchVersion != $shortMeilisearchVersion) {
|
||||
$formattedMeilisearchVersion .= ' (' . $meilisearchVersion . ')';
|
||||
}
|
||||
|
||||
return $formattedSolrVersion;
|
||||
return $formattedMeilisearchVersion;
|
||||
}
|
||||
}
|
@@ -26,45 +26,45 @@ namespace WapplerSystems\Meilisearch\Report;
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Reports\Status;
|
||||
|
||||
/**
|
||||
* Provides a status report about whether the installed Solr version matches
|
||||
* Provides a status report about whether the installed Meilisearch version matches
|
||||
* the required version.
|
||||
*
|
||||
* @author Stefan Sprenger <stefan.sprenger@dkd.de>
|
||||
*/
|
||||
class SolrVersionStatus extends AbstractSolrStatus
|
||||
class MeilisearchVersionStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
|
||||
/**
|
||||
* Required Solr version. The version that gets installed when using the
|
||||
* provided install script EXT:meilisearch/Resources/Private/Install/install-solr.sh
|
||||
* Required Meilisearch version. The version that gets installed when using the
|
||||
* provided install script EXT:meilisearch/Resources/Private/Install/install-meilisearch.sh
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const REQUIRED_SOLR_VERSION = '8.8.1';
|
||||
|
||||
/**
|
||||
* Compiles a version check against each configured Solr server.
|
||||
* Compiles a version check against each configured Meilisearch server.
|
||||
*
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
$reports = [];
|
||||
$solrConnections = GeneralUtility::makeInstance(ConnectionManager::class)->getAllConnections();
|
||||
$meilisearchConnections = GeneralUtility::makeInstance(ConnectionManager::class)->getAllConnections();
|
||||
|
||||
foreach ($solrConnections as $solrConnection) {
|
||||
$coreAdmin = $solrConnection->getAdminService();
|
||||
/** @var $solrConnection SolrConnection */
|
||||
foreach ($meilisearchConnections as $meilisearchConnection) {
|
||||
$coreAdmin = $meilisearchConnection->getAdminService();
|
||||
/** @var $meilisearchConnection MeilisearchConnection */
|
||||
if (!$coreAdmin->ping()) {
|
||||
$url = $coreAdmin->__toString();
|
||||
$pingFailedMsg = 'Could not ping solr server, can not check version ' . (string)$url;
|
||||
$pingFailedMsg = 'Could not ping meilisearch server, can not check version ' . (string)$url;
|
||||
$status = GeneralUtility::makeInstance(
|
||||
Status::class,
|
||||
/** @scrutinizer ignore-type */ 'Apache Solr Version',
|
||||
/** @scrutinizer ignore-type */ 'Meilisearch Version',
|
||||
/** @scrutinizer ignore-type */ 'Not accessible',
|
||||
/** @scrutinizer ignore-type */ $pingFailedMsg,
|
||||
/** @scrutinizer ignore-type */ Status::ERROR
|
||||
@@ -73,19 +73,19 @@ class SolrVersionStatus extends AbstractSolrStatus
|
||||
continue;
|
||||
}
|
||||
|
||||
$solrVersion = $coreAdmin->getSolrServerVersion();
|
||||
$isOutdatedVersion = version_compare($this->getCleanSolrVersion($solrVersion), self::REQUIRED_SOLR_VERSION, '<');
|
||||
$meilisearchVersion = $coreAdmin->getMeilisearchServerVersion();
|
||||
$isOutdatedVersion = version_compare($this->getCleanMeilisearchVersion($meilisearchVersion), self::REQUIRED_SOLR_VERSION, '<');
|
||||
|
||||
if (!$isOutdatedVersion) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$formattedVersion = $this->formatSolrVersion($solrVersion);
|
||||
$variables = ['requiredVersion' => self::REQUIRED_SOLR_VERSION, 'currentVersion' => $formattedVersion, 'solr' => $coreAdmin];
|
||||
$report = $this->getRenderedReport('SolrVersionStatus.html', $variables);
|
||||
$formattedVersion = $this->formatMeilisearchVersion($meilisearchVersion);
|
||||
$variables = ['requiredVersion' => self::REQUIRED_SOLR_VERSION, 'currentVersion' => $formattedVersion, 'meilisearch' => $coreAdmin];
|
||||
$report = $this->getRenderedReport('MeilisearchVersionStatus.html', $variables);
|
||||
$status = GeneralUtility::makeInstance(
|
||||
Status::class,
|
||||
/** @scrutinizer ignore-type */ 'Apache Solr Version',
|
||||
/** @scrutinizer ignore-type */ 'Meilisearch Version',
|
||||
/** @scrutinizer ignore-type */ 'Outdated, Unsupported',
|
||||
/** @scrutinizer ignore-type */ $report,
|
||||
/** @scrutinizer ignore-type */ Status::ERROR
|
||||
@@ -98,41 +98,41 @@ class SolrVersionStatus extends AbstractSolrStatus
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the clean Solr version in case of a custom build which may have
|
||||
* Gets the clean Meilisearch version in case of a custom build which may have
|
||||
* additional information in the version string.
|
||||
*
|
||||
* @param string $solrVersion Unformatted Apache Solr version number as provided by Solr.
|
||||
* @return string Clean Solr version number: mayor.minor.patchlevel
|
||||
* @param string $meilisearchVersion Unformatted Meilisearch version number as provided by Meilisearch.
|
||||
* @return string Clean Meilisearch version number: mayor.minor.patchlevel
|
||||
*/
|
||||
protected function getCleanSolrVersion($solrVersion)
|
||||
protected function getCleanMeilisearchVersion($meilisearchVersion)
|
||||
{
|
||||
$explodedSolrVersion = explode('.', $solrVersion);
|
||||
$explodedMeilisearchVersion = explode('.', $meilisearchVersion);
|
||||
|
||||
$shortSolrVersion = $explodedSolrVersion[0]
|
||||
. '.' . $explodedSolrVersion[1]
|
||||
. '.' . $explodedSolrVersion[2];
|
||||
$shortMeilisearchVersion = $explodedMeilisearchVersion[0]
|
||||
. '.' . $explodedMeilisearchVersion[1]
|
||||
. '.' . $explodedMeilisearchVersion[2];
|
||||
|
||||
return $shortSolrVersion;
|
||||
return $shortMeilisearchVersion;
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the Apache Solr server version number. By default this is going
|
||||
* Formats the Meilisearch server version number. By default this is going
|
||||
* to be the simple major.minor.patch-level version. Custom Builds provide
|
||||
* more information though, in case of custom builds, their complete
|
||||
* version will be added, too.
|
||||
*
|
||||
* @param string $solrVersion Unformatted Apache Solr version number as provided by Solr.
|
||||
* @param string $meilisearchVersion Unformatted Meilisearch version number as provided by Meilisearch.
|
||||
* @return string formatted short version number, in case of custom builds followed by the complete version number
|
||||
*/
|
||||
protected function formatSolrVersion($solrVersion)
|
||||
protected function formatMeilisearchVersion($meilisearchVersion)
|
||||
{
|
||||
$shortSolrVersion = $this->getCleanSolrVersion($solrVersion);
|
||||
$formattedSolrVersion = $shortSolrVersion;
|
||||
$shortMeilisearchVersion = $this->getCleanMeilisearchVersion($meilisearchVersion);
|
||||
$formattedMeilisearchVersion = $shortMeilisearchVersion;
|
||||
|
||||
if ($solrVersion != $shortSolrVersion) {
|
||||
$formattedSolrVersion .= ' (' . $solrVersion . ')';
|
||||
if ($meilisearchVersion != $shortMeilisearchVersion) {
|
||||
$formattedMeilisearchVersion .= ' (' . $meilisearchVersion . ')';
|
||||
}
|
||||
|
||||
return $formattedSolrVersion;
|
||||
return $formattedMeilisearchVersion;
|
||||
}
|
||||
}
|
@@ -25,7 +25,7 @@ namespace WapplerSystems\Meilisearch\Report;
|
||||
***************************************************************/
|
||||
|
||||
use WapplerSystems\Meilisearch\ConnectionManager;
|
||||
use WapplerSystems\Meilisearch\System\Solr\SolrConnection;
|
||||
use WapplerSystems\Meilisearch\System\Meilisearch\MeilisearchConnection;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Reports\Status;
|
||||
|
||||
@@ -35,7 +35,7 @@ use TYPO3\CMS\Reports\Status;
|
||||
*
|
||||
* @author Ingo Renner <ingo@typo3.org>
|
||||
*/
|
||||
class SchemaStatus extends AbstractSolrStatus
|
||||
class SchemaStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -53,7 +53,7 @@ class SchemaStatus extends AbstractSolrStatus
|
||||
|
||||
/**
|
||||
* Compiles a collection of schema version checks against each configured
|
||||
* Solr server. Only adds an entry if a schema other than the
|
||||
* Meilisearch server. Only adds an entry if a schema other than the
|
||||
* recommended one was found.
|
||||
*
|
||||
*/
|
||||
@@ -62,17 +62,17 @@ class SchemaStatus extends AbstractSolrStatus
|
||||
$reports = [];
|
||||
/** @var $connectionManager ConnectionManager */
|
||||
$connectionManager = GeneralUtility::makeInstance(ConnectionManager::class);
|
||||
$solrConnections = $connectionManager->getAllConnections();
|
||||
$meilisearchConnections = $connectionManager->getAllConnections();
|
||||
|
||||
foreach ($solrConnections as $solrConnection) {
|
||||
$adminService = $solrConnection->getAdminService();
|
||||
/** @var $solrConnection SolrConnection */
|
||||
foreach ($meilisearchConnections as $meilisearchConnection) {
|
||||
$adminService = $meilisearchConnection->getAdminService();
|
||||
/** @var $meilisearchConnection MeilisearchConnection */
|
||||
if (!$adminService->ping()) {
|
||||
$url = $adminService->__toString();
|
||||
$pingFailedMsg = 'Could not ping solr server, can not check version ' . (string)$url;
|
||||
$pingFailedMsg = 'Could not ping meilisearch server, can not check version ' . (string)$url;
|
||||
$status = GeneralUtility::makeInstance(
|
||||
Status::class,
|
||||
/** @scrutinizer ignore-type */ 'Apache Solr Version',
|
||||
/** @scrutinizer ignore-type */ 'Meilisearch Version',
|
||||
/** @scrutinizer ignore-type */ 'Not accessible',
|
||||
/** @scrutinizer ignore-type */ $pingFailedMsg,
|
||||
/** @scrutinizer ignore-type */ Status::ERROR
|
||||
@@ -83,7 +83,7 @@ class SchemaStatus extends AbstractSolrStatus
|
||||
|
||||
$isWrongSchema = $adminService->getSchema()->getName() != self::RECOMMENDED_SCHEMA_VERSION;
|
||||
if ($isWrongSchema) {
|
||||
$variables = ['solr' => $adminService, 'recommendedVersion' => self::RECOMMENDED_SCHEMA_VERSION];
|
||||
$variables = ['meilisearch' => $adminService, 'recommendedVersion' => self::RECOMMENDED_SCHEMA_VERSION];
|
||||
$report = $this->getRenderedReport('SchemaStatus.html', $variables);
|
||||
$status = GeneralUtility::makeInstance(
|
||||
Status::class,
|
||||
|
@@ -42,7 +42,7 @@ use TYPO3\CMS\Reports\Status;
|
||||
* * Entry Point[base] scheme expects -> http[s]
|
||||
* * Entry Point[base] authority expects -> [user-info@]host[:port]
|
||||
*/
|
||||
class SiteHandlingStatus extends AbstractSolrStatus
|
||||
class SiteHandlingStatus extends AbstractMeilisearchStatus
|
||||
{
|
||||
const TITLE_SITE_HANDLING_CONFIGURATION = 'Site handling configuration';
|
||||
|
||||
@@ -66,7 +66,7 @@ class SiteHandlingStatus extends AbstractSolrStatus
|
||||
protected $extensionConfiguration = null;
|
||||
|
||||
/**
|
||||
* SolrStatus constructor.
|
||||
* MeilisearchStatus constructor.
|
||||
* @param ExtensionConfiguration $extensionConfiguration
|
||||
* @param SiteRepository|null $siteRepository
|
||||
*/
|
||||
|
Reference in New Issue
Block a user