|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
namespace Shopware\Core\Content\Flow\Indexing; |
|
4
|
|
|
|
|
5
|
|
|
use Shopware\Core\Framework\App\Event\AppActivatedEvent; |
|
6
|
|
|
use Shopware\Core\Framework\App\Event\AppDeactivatedEvent; |
|
7
|
|
|
use Shopware\Core\Framework\App\Event\AppDeletedEvent; |
|
8
|
|
|
use Shopware\Core\Framework\App\Event\AppInstalledEvent; |
|
9
|
|
|
use Shopware\Core\Framework\App\Event\AppUpdatedEvent; |
|
10
|
|
|
use Shopware\Core\Framework\DataAbstractionLayer\Indexing\MessageQueue\IterateEntityIndexerMessage; |
|
11
|
|
|
use Shopware\Core\Framework\Log\Package; |
|
12
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPostActivateEvent; |
|
13
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPostDeactivateEvent; |
|
14
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPostInstallEvent; |
|
15
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPostUninstallEvent; |
|
16
|
|
|
use Shopware\Core\Framework\Plugin\Event\PluginPostUpdateEvent; |
|
17
|
|
|
use Symfony\Component\EventDispatcher\EventSubscriberInterface; |
|
18
|
|
|
use Symfony\Component\Messenger\MessageBusInterface; |
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* @internal |
|
22
|
|
|
*/ |
|
23
|
|
|
#[Package('business-ops')] |
|
24
|
|
|
class FlowIndexerSubscriber implements EventSubscriberInterface |
|
25
|
|
|
{ |
|
26
|
|
|
public function __construct(private readonly MessageBusInterface $messageBus) |
|
27
|
|
|
{ |
|
28
|
|
|
} |
|
29
|
|
|
|
|
30
|
|
|
public static function getSubscribedEvents(): array |
|
31
|
|
|
{ |
|
32
|
|
|
return [ |
|
33
|
|
|
PluginPostInstallEvent::class => 'refreshPlugin', |
|
34
|
|
|
PluginPostActivateEvent::class => 'refreshPlugin', |
|
35
|
|
|
PluginPostUpdateEvent::class => 'refreshPlugin', |
|
36
|
|
|
PluginPostDeactivateEvent::class => 'refreshPlugin', |
|
37
|
|
|
PluginPostUninstallEvent::class => 'refreshPlugin', |
|
38
|
|
|
AppInstalledEvent::class => 'refreshPlugin', |
|
39
|
|
|
AppUpdatedEvent::class => 'refreshPlugin', |
|
40
|
|
|
AppActivatedEvent::class => 'refreshPlugin', |
|
41
|
|
|
AppDeletedEvent::class => 'refreshPlugin', |
|
42
|
|
|
AppDeactivatedEvent::class => 'refreshPlugin', |
|
43
|
|
|
]; |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
public function refreshPlugin(): void |
|
47
|
|
|
{ |
|
48
|
|
|
// Schedule indexer to update flows |
|
49
|
|
|
$this->messageBus->dispatch(new IterateEntityIndexerMessage(FlowIndexer::NAME, null)); |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|