Use ext:solr garbage collector

parent f212542f
Pipeline #4319 passed with stages
in 5 minutes and 40 seconds
...@@ -14,6 +14,7 @@ namespace T3o\TerFe2\Controller; ...@@ -14,6 +14,7 @@ namespace T3o\TerFe2\Controller;
* The TYPO3 project - inspiring people to share! * The TYPO3 project - inspiring people to share!
*/ */
use ApacheSolrForTypo3\Solr\GarbageCollector;
use ApacheSolrForTypo3\Solr\IndexQueue\Queue; use ApacheSolrForTypo3\Solr\IndexQueue\Queue;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
...@@ -225,11 +226,13 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr ...@@ -225,11 +226,13 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr
} elseif ((strtolower($extension->getFrontendUser()) == strtolower($GLOBALS['TSFE']->fe_user->user['username'])) || $this->securityRole->isAdmin()) { } elseif ((strtolower($extension->getFrontendUser()) == strtolower($GLOBALS['TSFE']->fe_user->user['username'])) || $this->securityRole->isAdmin()) {
// Deleted in ter, then delete the key in the ter_fe2 extension table // Deleted in ter, then delete the key in the ter_fe2 extension table
if ($this->terConnection->deleteExtensionKey($extension->getExtKey())) { if ($this->terConnection->deleteExtensionKey($extension->getExtKey())) {
$extensionUid = $extension->getUid();
$this->extensionRepository->remove($extension); $this->extensionRepository->remove($extension);
// remove from index queue
// ext:solr garbage collector
if (ExtensionManagementUtility::isLoaded('solr')) { if (ExtensionManagementUtility::isLoaded('solr')) {
$indexQueue = GeneralUtility::makeInstance(Queue::class); $garbageCollector = GeneralUtility::makeInstance(GarbageCollector::class);
$indexQueue->deleteItem('tx_terfe2_domain_model_extension', $extension->getUid()); $garbageCollector->collectGarbage('tx_terfe2_domain_model_extension', $extensionUid);
} }
$this->addFlashMessage( $this->addFlashMessage(
'', '',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment