module = $module; $this->installer = $installer; } public static function create(Module $module): self { $db = Db::getInstance(); $dbInstaller = new DatabaseInstaller(new Configuration($db), [ new Version_2_2_0(new Connection($db)), ]); return new self($module, $dbInstaller); } public function upgrade(): bool { CacheClearer::getInstance()->clear(); $this->installer->install($this->module); return $this->registerHooks(); } private function registerHooks(): bool { return $this->module->registerHook([ ActionEmailSendBefore::HOOK_NAME, ActionAdminInPostConfirmedShipmentsControllerAfter::HOOK_NAME, ActionAdminInPostConfirmedShipmentsControllerBefore::HOOK_NAME, DisplayHeader::HOOK_NAME, ]); } } /** * @param InPostIzi $module */ function upgrade_module_2_2_0(Module $module): bool { return InPostIziUpdater_2_2_0::create($module)->upgrade(); }