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] Remove content stream usage #4073

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
21 changes: 1 addition & 20 deletions Classes/Report/SolrStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,10 @@ protected function getConnectionStatus(Site $site, array $solrConnection): Statu
$pingTime = $this->checkPingTime($solrAdmin);
$configName = $this->checkSolrConfigName($solrAdmin);
$schemaName = $this->checkSolrSchemaName($solrAdmin);
$streamBodySetting = $this->checkStreamBodySetting($solrAdmin);

/** @phpstan-ignore-next-line */
if ($this->responseStatus !== ContextualFeedbackSeverity::OK) {
$header = 'Failed contacting the Solr server or invalid settings found.';
$header = 'Failed contacting the Solr server.';
}

$variables = [
Expand All @@ -138,7 +137,6 @@ protected function getConnectionStatus(Site $site, array $solrConnection): Statu
'configName' => $configName,
'schemaName' => $schemaName,
'accessFilter' => $accessFilter,
'streamBodySetting' => $streamBodySetting,
];

$report = $this->getRenderedReport('SolrStatus.html', $variables);
Expand Down Expand Up @@ -229,23 +227,6 @@ protected function checkSolrSchemaName(SolrAdminService $solrAdminService): stri
return $solrSchemaMessage;
}

protected function checkStreamBodySetting(SolrAdminService $solrAdminService): string
{
$systemProperties = $solrAdminService->getSystemProperties();
if ($systemProperties === null) {
$this->responseStatus = ContextualFeedbackSeverity::ERROR;
return 'Error determining system properties';
}

$streamSetting = (bool)($systemProperties['solr.enableStreamBody'] ?? false);
if (!$streamSetting) {
$this->responseStatus = ContextualFeedbackSeverity::ERROR;
return 'Content Streams not enabled';
}

return 'true';
}

/**
* Formats the Apache Solr server version number. By default, this is going
* to be the simple major.minor.patch-level version. Custom Builds provide
Expand Down
21 changes: 0 additions & 21 deletions Classes/System/Solr/Service/SolrAdminService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ class SolrAdminService extends AbstractSolrService
public const LUKE_SERVLET = 'admin/luke';
public const SYSTEM_SERVLET = 'admin/system';
public const CORES_SERVLET = '../admin/cores';
public const PROPERTY_SERVLET = '../admin/info/properties';
public const FILE_SERVLET = 'admin/file';
public const SCHEMA_SERVLET = 'schema';
public const SYNONYMS_SERVLET = 'schema/analysis/synonyms/';
Expand Down Expand Up @@ -89,26 +88,6 @@ public function system(): ResponseAdapter
return $this->_sendRawGet($this->_constructUrl(self::SYSTEM_SERVLET, ['wt' => 'json']));
}

/**
* Gets system properties
*
* @return array|null
*/
public function getSystemProperties(): ?array
{
$url = $this->_constructUrl(self::PROPERTY_SERVLET, ['wt' => 'json']);
$propertyInformation = $this->_sendRawGet($url);

$parsedPropertyInformation = $propertyInformation->getParsedData();
if ($parsedPropertyInformation === null
|| !property_exists($parsedPropertyInformation, 'system.properties')
) {
return null;
}

return (array)$parsedPropertyInformation->{'system.properties'};
}

/**
* Gets information about the plugins installed in Solr
*
Expand Down
6 changes: 1 addition & 5 deletions Docker/SolrServer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ RUN rm -fR /opt/solr/server/solr/* \
&& groupmod --non-unique --gid "${SOLR_UNIX_GID}" solr \
&& chown -R solr:solr /var/solr /opt/solr \
&& apt update && apt upgrade -y && apt install sudo -y \
&& echo "solr ALL=NOPASSWD: /docker-entrypoint-initdb.d/as-sudo/*" > /etc/sudoers.d/solr \
&& echo "# EXT:solr relevant changes: " >> /etc/default/solr.in.sh \
&& echo "SOLR_ENABLE_REMOTE_STREAMING=true" >> /etc/default/solr.in.sh \
&& echo "SOLR_ENABLE_STREAM_BODY=true" >> /etc/default/solr.in.sh \
&& echo "# END: EXT:solr" >> /etc/default/solr.in.sh
&& echo "solr ALL=NOPASSWD: /docker-entrypoint-initdb.d/as-sudo/*" > /etc/sudoers.d/solr

COPY Docker/SolrServer/docker-entrypoint-initdb.d/ /docker-entrypoint-initdb.d
USER solr
Expand Down
1 change: 0 additions & 1 deletion Documentation/Solr/ConfigurationStructures.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ When you want to install Solr on your system in another way the following steps
* Install the Solr server
* Copy the configsets into the configset folder (by default $SOLR_HOME/server/solr/configsets)
* Make sure that the solr.xml file ($SOLR_HOME/server/solr/solr.xml) is in place and fits to your Solr version
* Enable Content Streams. EXT:solr uses content streams and requires environment variables SOLR_ENABLE_REMOTE_STREAMING and SOLR_ENABLE_STREAM_BODY to be set, see section `Content Streams in the Reference Guide <https://solr.apache.org/guide/solr/latest/indexing-guide/content-streams.html>`__

* Create an init script that starts Solr on boottime.
* Secure your Solr port from outside.
Expand Down
6 changes: 0 additions & 6 deletions Resources/Private/Templates/Backend/Reports/SolrStatus.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@
<th>Access Filter Plugin</th>
<td>{accessFilter}</td>
</tr>
<tr>
<th>Content Streams<br><small>(SOLR_ENABLE_REMOTE_STREAMING)</small></th>
<td class="{f:if(condition:'{streamBodySetting} !== \'true\'', then: 'warning')}">
{streamBodySetting}
</td>
</tr>
</table>

</html>
13 changes: 12 additions & 1 deletion Tests/Integration/IntegrationTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use TYPO3\CMS\Core\Core\Environment;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Http\RequestFactory;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait;
Expand Down Expand Up @@ -102,7 +103,17 @@ protected function cleanUpSolrServerAndAssertEmpty(?string $coreName = 'core_en'
$this->validateTestCoreName($coreName);

// cleanup the solr server
$result = file_get_contents($this->getSolrConnectionUriAuthority() . '/solr/' . $coreName . '/update?stream.body=<delete><query>*:*</query></delete>&commit=true');
$requestFactory = GeneralUtility::makeInstance(RequestFactory::class);
$response = $requestFactory->request(
$this->getSolrConnectionUriAuthority() . '/solr/' . $coreName . '/update',
'POST',
[
'headers' => ['Content-Type' => 'application/xml'],
'body' => '<delete><query>*:*</query></delete>',
]
);
$result = $response->getBody()->getContents();

if (!str_contains($result, '<int name="QTime">')) {
self::fail('Could not empty solr test index');
}
Expand Down