Commit 27126b19 authored by Tomas Norre Mikkelsen's avatar Tomas Norre Mikkelsen

Merge branch 'remove-extension-from-solr-index-when-removed-all-versions' into 'develop'

Remove extension from index if all versions deleted

See merge request !235
parents 6100503d 588df510
Pipeline #2381 passed with stages
in 2 minutes and 15 seconds
...@@ -26,6 +26,10 @@ namespace T3o\TerFe2\Controller; ...@@ -26,6 +26,10 @@ namespace T3o\TerFe2\Controller;
* This copyright notice MUST APPEAR in all copies of the script! * This copyright notice MUST APPEAR in all copies of the script!
* **************************************************************** */ * **************************************************************** */
use ApacheSolrForTypo3\Solr\IndexQueue\Queue;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/** /**
* Controller for the extension key registration * Controller for the extension key registration
*/ */
...@@ -276,6 +280,11 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr ...@@ -276,6 +280,11 @@ class RegisterkeyController extends \T3o\TerFe2\Controller\AbstractTerBasedContr
$this->versionRepository->remove($version); $this->versionRepository->remove($version);
if (empty($version->getExtension()->getVersions())) { if (empty($version->getExtension()->getVersions())) {
$redirectToIndexAction = true; $redirectToIndexAction = true;
// remove from index queue
if (ExtensionManagementUtility::isLoaded('solr')) {
$indexQueue = GeneralUtility::makeInstance(Queue::class);
$indexQueue->deleteItem('tx_terfe2_domain_model_extension', $version->getExtension()->getUid());
}
} }
$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