* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ namespace PrestaShop\Module\PsAccounts\Hook; use PrestaShop\Module\PsAccounts\Account\Command\UpgradeModuleMultiCommand; use PrestaShop\Module\PsAccounts\Vendor\League\OAuth2\Client\Provider\Exception\IdentityProviderException; class DisplayBackOfficeHeader extends Hook { /** * @return void */ public function execute(array $params = []) { if (defined('_PS_VERSION_') && version_compare(_PS_VERSION_, '8', '>=')) { try { $this->module->getOauth2Middleware()->execute(); } catch (IdentityProviderException $e) { $this->logger->error('error while executing middleware : ' . $e->getMessage()); /* @phpstan-ignore-next-line */ } catch (\Exception $e) { /* @phpstan-ignore-next-line */ $this->logger->error('error while executing middleware : ' . $e->getMessage()); } } try { $this->commandBus->handle(new UpgradeModuleMultiCommand()); } catch (\Exception $e) { /* @phpstan-ignore-next-line */ $this->logger->error('error during upgrade : ' . $e->getMessage()); } } }