From cbc2f251f625fbce142ce581b616d57c8b722883 Mon Sep 17 00:00:00 2001 From: PululuK Date: Mon, 12 Feb 2024 13:14:38 +0100 Subject: [PATCH] Do not initialize context when the store is already initialized in CLI --- classes/controller/AdminController.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index 665d03994ec52..8dacd8df8a0cc 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -2881,6 +2881,11 @@ public function initShopContext() return; } + // Do not initialize context when the store is already initialized in CLI + if (Tools::isPHPCLI() && $this->context) { + return; + } + // Change shop context ? if (Shop::isFeatureActive() && Tools::getValue('setShopContext') !== false) { $this->context->cookie->shopContext = Tools::getValue('setShopContext');