first commit
This commit is contained in:
@@ -26,12 +26,12 @@ namespace WapplerSystems\Meilisearch\Task;
|
||||
|
||||
use WapplerSystems\Meilisearch\Domain\Site\SiteRepository;
|
||||
use WapplerSystems\Meilisearch\Domain\Site\Site;
|
||||
use WapplerSystems\Meilisearch\System\Logging\SolrLogManager;
|
||||
use WapplerSystems\Meilisearch\System\Logging\MeilisearchLogManager;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Scheduler\Task\AbstractTask;
|
||||
|
||||
/**
|
||||
* Abstract scheduler task for solr scheduler tasks, contains the logic to
|
||||
* Abstract scheduler task for meilisearch scheduler tasks, contains the logic to
|
||||
* retrieve the site, avoids serialization of site, when scheduler task is saved.
|
||||
*/
|
||||
abstract class AbstractMeilisearchTask extends AbstractTask {
|
||||
@@ -80,8 +80,8 @@ abstract class AbstractMeilisearchTask extends AbstractTask {
|
||||
$siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
|
||||
$this->site = $siteRepository->getSiteByRootPageId($this->rootPageId);
|
||||
} catch (\InvalidArgumentException $e) {
|
||||
$logger = GeneralUtility::makeInstance(SolrLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
|
||||
$logger->log(SolrLogManager::ERROR, 'Scheduler task tried to get invalid site');
|
||||
$logger = GeneralUtility::makeInstance(MeilisearchLogManager::class, /** @scrutinizer ignore-type */ __CLASS__);
|
||||
$logger->log(MeilisearchLogManager::ERROR, 'Scheduler task tried to get invalid site');
|
||||
}
|
||||
|
||||
return $this->site;
|
||||
|
@@ -50,7 +50,7 @@ class IndexQueueWorkerTask extends AbstractMeilisearchTask implements ProgressPr
|
||||
protected $forcedWebRoot = '';
|
||||
|
||||
/**
|
||||
* Works through the indexing queue and indexes the queued items into Solr.
|
||||
* Works through the indexing queue and indexes the queued items into Meilisearch.
|
||||
*
|
||||
* @return bool Returns TRUE on success, FALSE if no items were indexed or none were found.
|
||||
*/
|
||||
@@ -60,7 +60,7 @@ class IndexQueueWorkerTask extends AbstractMeilisearchTask implements ProgressPr
|
||||
|
||||
// Wrapped the CliEnvironment to avoid defining TYPO3_PATH_WEB since this
|
||||
// should only be done in the case when running it from outside TYPO3 BE
|
||||
// @see #921 and #934 on https://github.com/TYPO3-Solr
|
||||
// @see #921 and #934 on https://github.com/TYPO3-Meilisearch
|
||||
if (TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_CLI) {
|
||||
$cliEnvironment = GeneralUtility::makeInstance(CliEnvironment::class);
|
||||
$cliEnvironment->backup();
|
||||
|
@@ -32,7 +32,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
/**
|
||||
* Scheduler task to empty the indexes of a site and re-initialize the
|
||||
* Solr Index Queue thus making the indexer re-index the site.
|
||||
* Meilisearch Index Queue thus making the indexer re-index the site.
|
||||
*
|
||||
* @author Christoph Moeller <support@network-publishing.de>
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ class ReIndexTask extends AbstractMeilisearchTask
|
||||
protected $indexingConfigurationsToReIndex = [];
|
||||
|
||||
/**
|
||||
* Purges/commits all Solr indexes, initializes the Index Queue
|
||||
* Purges/commits all Meilisearch indexes, initializes the Index Queue
|
||||
* and returns TRUE if the execution was successful
|
||||
*
|
||||
* @return bool Returns TRUE on success, FALSE on failure.
|
||||
@@ -74,26 +74,26 @@ class ReIndexTask extends AbstractMeilisearchTask
|
||||
protected function cleanUpIndex()
|
||||
{
|
||||
$cleanUpResult = true;
|
||||
$solrConfiguration = $this->getSite()->getSolrConfiguration();
|
||||
$solrServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->getSite());
|
||||
$meilisearchConfiguration = $this->getSite()->getMeilisearchConfiguration();
|
||||
$meilisearchServers = GeneralUtility::makeInstance(ConnectionManager::class)->getConnectionsBySite($this->getSite());
|
||||
$typesToCleanUp = [];
|
||||
$enableCommitsSetting = $solrConfiguration->getEnableCommits();
|
||||
$enableCommitsSetting = $meilisearchConfiguration->getEnableCommits();
|
||||
|
||||
foreach ($this->indexingConfigurationsToReIndex as $indexingConfigurationName) {
|
||||
$type = $solrConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
|
||||
$type = $meilisearchConfiguration->getIndexQueueTableNameOrFallbackToConfigurationName($indexingConfigurationName);
|
||||
$typesToCleanUp[] = $type;
|
||||
}
|
||||
|
||||
foreach ($solrServers as $solrServer) {
|
||||
foreach ($meilisearchServers as $meilisearchServer) {
|
||||
$deleteQuery = 'type:(' . implode(' OR ', $typesToCleanUp) . ')' . ' AND siteHash:' . $this->getSite()->getSiteHash();
|
||||
$solrServer->getWriteService()->deleteByQuery($deleteQuery);
|
||||
$meilisearchServer->getWriteService()->deleteByQuery($deleteQuery);
|
||||
|
||||
if (!$enableCommitsSetting) {
|
||||
# Do not commit
|
||||
continue;
|
||||
}
|
||||
|
||||
$response = $solrServer->getWriteService()->commit(false, false, false);
|
||||
$response = $meilisearchServer->getWriteService()->commit(false, false, false);
|
||||
if ($response->getHttpStatus() != 200) {
|
||||
$cleanUpResult = false;
|
||||
break;
|
||||
|
@@ -38,7 +38,7 @@ use TYPO3\CMS\Scheduler\Task\AbstractTask;
|
||||
use TYPO3\CMS\Scheduler\Task\Enumeration\Action;
|
||||
|
||||
/**
|
||||
* Adds an additional field to specify the Solr server to initialize the index queue for
|
||||
* Adds an additional field to specify the Meilisearch server to initialize the index queue for
|
||||
*
|
||||
* @author Christoph Moeller <support@network-publishing.de>
|
||||
*/
|
||||
@@ -115,7 +115,7 @@ class ReIndexTaskAdditionalFieldProvider implements AdditionalFieldProviderInter
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to define fields to provide the Solr server address when adding
|
||||
* Used to define fields to provide the Meilisearch server address when adding
|
||||
* or editing a task.
|
||||
*
|
||||
* @param array $taskInfo reference to the array containing the info used in the add/edit form
|
||||
@@ -160,7 +160,7 @@ class ReIndexTaskAdditionalFieldProvider implements AdditionalFieldProviderInter
|
||||
protected function getIndexingConfigurationSelector()
|
||||
{
|
||||
$selectorMarkup = 'Please select a site first.';
|
||||
$this->getPageRenderer()->addCssFile('../typo3conf/ext/solr/Resources/Css/Backend/indexingconfigurationselectorfield.css');
|
||||
$this->getPageRenderer()->addCssFile('../typo3conf/ext/meilisearch/Resources/Css/Backend/indexingconfigurationselectorfield.css');
|
||||
|
||||
if (is_null($this->site)) {
|
||||
return $selectorMarkup;
|
||||
|
Reference in New Issue
Block a user