File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change 5
5
use Algolia \AlgoliaSearch \Helper \Entity \ProductHelper ;
6
6
use Algolia \AlgoliaSearch \Registry \ReplicaState ;
7
7
use Algolia \AlgoliaSearch \Service \Product \ReplicaManager ;
8
+ use Magento \Framework \App \Area ;
8
9
use Magento \Framework \App \State as AppState ;
10
+ use Magento \Framework \Exception \LocalizedException ;
9
11
use Magento \Framework \Setup \ModuleDataSetupInterface ;
10
12
use Magento \Framework \Setup \Patch \DataPatchInterface ;
11
13
use Magento \Framework \Setup \Patch \PatchInterface ;
@@ -47,7 +49,11 @@ public function getAliases(): array
47
49
public function apply (): PatchInterface
48
50
{
49
51
$ this ->moduleDataSetup ->getConnection ()->startSetup ();
50
- $ this ->appState ->setAreaCode (\Magento \Framework \App \Area::AREA_ADMINHTML );
52
+ try {
53
+ $ this ->appState ->setAreaCode (Area::AREA_ADMINHTML );
54
+ } catch (LocalizedException ) {
55
+ // Area code is already set - nothing to do
56
+ }
51
57
52
58
$ storeIds = array_keys ($ this ->storeManager ->getStores ());
53
59
// Delete all replicas before resyncing in case of incorrect replica assignments
You can’t perform that action at this time.
0 commit comments