Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TASK] Support several Apache Solr versions #3956

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions Classes/Report/SolrVersionStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
use ApacheSolrForTypo3\Solr\Domain\Site\Exception\UnexpectedTYPO3SiteInitializationException;
use ApacheSolrForTypo3\Solr\System\Solr\SolrConnection;
use TYPO3\CMS\Core\Type\ContextualFeedbackSeverity;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Reports\Status;

Expand All @@ -32,11 +33,6 @@
*/
class SolrVersionStatus extends AbstractSolrStatus
{
/**
* Required Solr version. The version that gets installed when using the provided Docker image.
*/
public const REQUIRED_SOLR_VERSION = '9.3.0';

/**
* Compiles a version check against each configured Solr server.
*
Expand Down Expand Up @@ -65,9 +61,10 @@ public function getStatus(): array
}

$solrVersion = $coreAdmin->getSolrServerVersion();
$isOutdatedVersion = version_compare($this->getCleanSolrVersion($solrVersion), self::REQUIRED_SOLR_VERSION, '<');
$supportedSolrVersions = $this->getSupportedSolrVersions();
$isSupported = in_array($this->getCleanSolrVersion($solrVersion), $supportedSolrVersions);

if (!$isOutdatedVersion) {
if ($isSupported) {
$reports[] = GeneralUtility::makeInstance(
Status::class,
'Apache Solr Version',
Expand All @@ -79,12 +76,16 @@ public function getStatus(): array
}

$formattedVersion = $this->formatSolrVersion($solrVersion);
$variables = ['requiredVersion' => self::REQUIRED_SOLR_VERSION, 'currentVersion' => $formattedVersion, 'solr' => $coreAdmin];
$variables = [
'supportedSolrVersions' => $supportedSolrVersions,
'currentVersion' => $formattedVersion,
'solr' => $coreAdmin,
];
$report = $this->getRenderedReport('SolrVersionStatus.html', $variables);
$status = GeneralUtility::makeInstance(
Status::class,
'Apache Solr Version',
'Outdated, Unsupported',
'Unsupported',
$report,
ContextualFeedbackSeverity::ERROR
);
Expand All @@ -95,6 +96,13 @@ public function getStatus(): array
return $reports;
}

protected function getSupportedSolrVersions(): array
{
$composerContents = file_get_contents(ExtensionManagementUtility::extPath('solr') . 'composer.json');
$composerConfiguration = json_decode($composerContents, true, 25, JSON_OBJECT_AS_ARRAY);
return $composerConfiguration['extra']['TYPO3-Solr']['version-matrix']['Apache-Solr'] ?? [];
}

/**
* {@inheritDoc}
*/
Expand Down
2 changes: 1 addition & 1 deletion Docker/SolrServer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM solr:9.3.0
FROM solr:9.5.0
MAINTAINER dkd Internet Service GmbH <[email protected]>
ENV TERM linux

Expand Down
10 changes: 6 additions & 4 deletions Documentation/Appendix/VersionMatrix.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ List of EXT:solr versions and the matching versions of Apache Solr and TYPO3 tha
------------------------------- ---------------------------------------------- -------------------------------- --------------- ---------------------------------
TYPO3 EXT:solr EXT:tika EXT:solrfal EXT:solrconsole EXT:solrdebugtools EXT:solrfluidgrouping EXT:solrmlt Apache Solr Configset
========= ========== ========== =========== =============== ================== ================================ =============== =============== =================
12.4 12.0 12.0 12.0 12.0 (Ø) 12.0 N/A (integrated in EXT:solr) 12.0 (Ø) 9.3.0 ext_solr_12_0_0
11.5 11.5 11.0 11.0 11.0 11.0 11.0 11.0 (Ø) 8.11.1 ext_solr_11_5_0
12.4 12.0 12.0 12.0 12.0 12.0 N/A (integrated in EXT:solr) 12.0 (Ø) 9.5.0¹ ext_solr_12_0_0
11.5 11.5 11.0 11.0 11.0 11.0 11.0 11.0 (Ø) 8.11. ext_solr_11_5_0
========= ========== ========== =========== =============== ================== ================================ =============== =============== =================

| Ø - not yet available
| ᾱ - non stable alpha release
| β - non stable beta release
| rc - release candidate available
|¹ - recommended Apache Solr version, check version matrix in composer.json (composer info:solr-versions) for full list

.. important::

Expand All @@ -40,13 +41,14 @@ selected older versions. The following table illustrates the offers and availabl
-------------------------------- ---------------------------------------------- ------------------------------------
TYPO3 EXT:solr EXT:tika EXT:solrfal EXT:solrconsole EXT:solrdebugtools Apache Solr Configset
========= =========== ========== =========== =============== ================== =============== ====================
10.4 11.2.4+ Ø 10.0 10.0 10.0 10.0 9.2.1 ext_solr_11_2_0_elts
9.5-10.4 11.0.8+ 6.0.3+ 8.0.2+ 4.0.2+ 1.1.3+ 9.2.1 ext_solr_11_0_0_elts
10.4 11.2.4+ 10.0 10.0 10.0 10.0 9.5.0¹ ext_solr_11_2_0_elts
9.5-10.4 11.0.9+ 6.0.3+ 8.0.2+ 4.0.2+ 1.1.3+ 9.5.0¹ ext_solr_11_0_0_elts
========= =========== ========== =========== =============== ================== =============== ====================

Our Apache Solr for TYPO3 EB-partners newsletter will keep you updated!

Ø - not yet available
¹ - recommended Apache Solr version, check version matrix in composer.json (composer info:solr-versions) for full list

No longer supported versions
----------------------------
Expand Down
52 changes: 32 additions & 20 deletions Resources/Private/Templates/Backend/Reports/SolrVersionStatus.html
Original file line number Diff line number Diff line change
@@ -1,22 +1,34 @@
<p style="margin-bottom: 10px;">Found an
outdated Apache Solr server version. <br />The <strong>minimum
required version is <code>{requiredVersion}</code></strong>, you have <code>{currentVersion}</code>.</p>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xmlns:f="http://typo3.org/ns/TYPO3/Fluid/ViewHelpers"
data-namespace-typo3-fluid="true"
>

<p style="margin-bottom: 10px;">Found an unsupported Apache Solr server version. <br />
It is strongly recommended to use one of the explicitly tested versions, preferably the latest one.<br />
The currently supported versions are:
<f:for each="{supportedSolrVersions}" as="version" iteration="iterator">
<strong><code>{version}</code></strong>{f:if(condition: '{iterator.isLast}', then: '.', else: ',')}
</f:for>
<br />Your version is: <code>{currentVersion}</code>.
</p>
<table class="table table-condensed table-hover table-striped">
<thead>
<tr>
<td colspan="2">Affected Solr server</td>
</tr>
</thead>
<tr>
<th>Host</th>
<td>{solr.primaryEndpoint.host}</td>
</tr>
<tr>
<th>Path</th>
<td>{solr.corePath}</td>
</tr>
<tr>
<th>Port</th>
<td>{solr.primaryEndpoint.port}</td>
</tr>
<thead>
<tr>
<td colspan="2">Affected Solr server</td>
</tr>
</thead>
<tr>
<th>Host</th>
<td>{solr.primaryEndpoint.host}</td>
</tr>
<tr>
<th>Path</th>
<td>{solr.corePath}</td>
</tr>
<tr>
<th>Port</th>
<td>{solr.primaryEndpoint.port}</td>
</tr>
</table>

</html>
13 changes: 12 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@
}
},
"scripts": {
"info:solr-versions": [
"@composer config extra.TYPO3-Solr.version-matrix.Apache-Solr"
],
"info:recommended-solr-version": [
"@composer config extra.TYPO3-Solr.version-matrix.Apache-Solr.0"
],
"post-autoload-dump": [
"mkdir -p .Build/vendor/apache-solr-for-typo3",
"[ -L .Build/vendor/apache-solr-for-typo3/solr ] || ln -snvf ../../../. .Build/vendor/apache-solr-for-typo3/solr"
Expand Down Expand Up @@ -143,7 +149,12 @@
"ext-solrconsole": "^12.0",
"ext-solrdebugtools": "^12.0",
"ext-solrmlt": "^12.0",
"Apache-Solr": "9.3.0",
"Apache-Solr": [
"9.5.0",
"9.4.1",
"9.4.0",
"9.3.0"
],
"configset": "ext_solr_12_0_0"
},
"ext-solrfal": {
Expand Down
Loading