|
7 | 7 |
|
8 | 8 | namespace Magento\CatalogSearch\Setup\Patch\Data;
|
9 | 9 |
|
| 10 | +use Magento\Framework\App\Config\ScopeConfigInterface; |
| 11 | +use Magento\Framework\Notification\NotifierInterface; |
| 12 | +use Magento\Framework\Setup\Patch\DataPatchInterface; |
| 13 | + |
10 | 14 | /**
|
11 | 15 | * Implementation of the notification about MySQL search being removed.
|
12 | 16 | *
|
13 | 17 | * @see \Magento\ElasticSearch
|
14 | 18 | */
|
15 |
| -class MySQLSearchRemovalNotification implements \Magento\Framework\Setup\Patch\DataPatchInterface |
| 19 | +class MySQLSearchRemovalNotification implements DataPatchInterface |
16 | 20 | {
|
17 | 21 | /**
|
18 |
| - * @var \Magento\Framework\Search\EngineResolverInterface |
| 22 | + * @var NotifierInterface |
19 | 23 | */
|
20 |
| - private $searchEngineResolver; |
| 24 | + private $notifier; |
21 | 25 |
|
22 | 26 | /**
|
23 |
| - * @var \Magento\Framework\Notification\NotifierInterface |
| 27 | + * @var ScopeConfigInterface |
24 | 28 | */
|
25 |
| - private $notifier; |
| 29 | + private $scopeConfig; |
26 | 30 |
|
27 | 31 | /**
|
28 |
| - * @param \Magento\Framework\Search\EngineResolverInterface $searchEngineResolver |
29 |
| - * @param \Magento\Framework\Notification\NotifierInterface $notifier |
| 32 | + * @param NotifierInterface $notifier |
| 33 | + * @param ScopeConfigInterface $scopeConfig |
30 | 34 | */
|
31 | 35 | public function __construct(
|
32 |
| - \Magento\Framework\Search\EngineResolverInterface $searchEngineResolver, |
33 |
| - \Magento\Framework\Notification\NotifierInterface $notifier |
| 36 | + NotifierInterface $notifier, |
| 37 | + ScopeConfigInterface $scopeConfig |
34 | 38 | ) {
|
35 |
| - $this->searchEngineResolver = $searchEngineResolver; |
36 | 39 | $this->notifier = $notifier;
|
| 40 | + $this->scopeConfig = $scopeConfig; |
37 | 41 | }
|
38 | 42 |
|
39 | 43 | /**
|
40 | 44 | * @inheritdoc
|
41 | 45 | */
|
42 | 46 | public function apply()
|
43 | 47 | {
|
44 |
| - if ($this->searchEngineResolver->getCurrentSearchEngine() === 'mysql') { |
| 48 | + if ($this->scopeConfig->getValue('catalog/search/engine') === 'mysql') { |
45 | 49 | $message = <<<MESSAGE
|
46 | 50 | Catalog Search is currently configured to use the MySQL engine, which has been deprecated and removed. Migrate to one of
|
47 | 51 | the Elasticsearch engines to ensure there are no service interruptions.
|
|
0 commit comments