src/OpenCart/Helpers/OcHelper.php
protected function doUpgrade()
    {
        //Install/update datamodel first.
        $result = $this->doInstall();

        $this->registry->load->model('setting/setting');
        $setting = $this->registry->model_setting_setting->getSetting('acumulus_siel');
        $currentDataModelVersion = isset($setting['acumulus_siel_datamodel_version']) ? $setting['acumulus_siel_datamodel_version'] : '';
        $apiVersion = PluginConfig::Version;

        $this->container->getLog()->info('%s: installed version = %s, API = %s', __METHOD__, $currentDataModelVersion, $apiVersion);

        if (version_compare($currentDataModelVersion, $apiVersion, '<')) {
            // Update config settings.
            if ($result = $this->container->getConfig()->upgrade($currentDataModelVersion)) {
                // Refresh settings.
                $setting = $this->registry->model_setting_setting->getSetting('acumulus_siel');
                $setting['acumulus_siel_datamodel_version'] = $apiVersion;
                $this->registry->model_setting_setting->editSetting('acumulus_siel', $setting);
            }
        }

        return $result;
    }
protected function doUpgrade()
    {
        //Install/update datamodel first.
        $result = $this->doInstall();

        $this->registry->load->model('setting/setting');
        $setting = $this->registry->model_setting_setting->getSetting('acumulus_siel');
        $currentDataModelVersion = isset($setting['acumulus_siel_datamodel_version']) ? $setting['acumulus_siel_datamodel_version'] : '';
        $apiVersion = PluginConfig::Version;

        $this->container->getLog()->info('%s: installed version = %s, API = %s', __METHOD__, $currentDataModelVersion, $apiVersion);

        if (version_compare($currentDataModelVersion, $apiVersion, '<')) {
            // Update config settings.
            if ($result = $this->container->getConfig()->upgrade($currentDataModelVersion)) {
                // Refresh settings.
                $setting = $this->registry->model_setting_setting->getSetting('acumulus_siel');
                $setting['acumulus_siel_datamodel_version'] = $apiVersion;
                $this->registry->model_setting_setting->editSetting('acumulus_siel', $setting);
            }
        }

        return $result;
    }
protected function doUpgrade ( ) { //Install/update datamodel first. $ result = $ this -> doInstall ( ) ; $ this -> registry -> load -> model ( 'setting/setting' ) ; $ setting = $ this -> registry -> model_setting_setting -> getSetting ( 'acumulus_siel' ) ; $ currentDataModelVersion = isset ( $ setting [ 'acumulus_siel_datamodel_version' ] ) ? $ setting [ 'acumulus_siel_datamodel_version' ] : '' ; $ apiVersion = PluginConfig :: Version ; $ this -> container -> getLog ( ) -> info ( '%s: installed version = %s, API = %s' , __METHOD__ , $ currentDataModelVersion , $ apiVersion ) ; if ( version_compare ( $ currentDataModelVersion , $ apiVersion , '<' ) ) { // Update config settings. if ( $ result = $ this -> container -> getConfig ( ) -> upgrade ( $ currentDataModelVersion ) ) { // Refresh settings. $ setting = $ this -> registry -> model_setting_setting -> getSetting ( 'acumulus_siel' ) ; $ setting [ 'acumulus_siel_datamodel_version' ] = $ apiVersion ; $ this -> registry -> model_setting_setting -> editSetting ( 'acumulus_siel' , $ setting ) ; } } return $ result ; }
Upgrades the data and settings for this module if needed.

The install now checks for the data model and can do an upgrade instead
of a clean install.

@return bool
Whether the upgrade was successful.

@throws \Exception
Upgrades the data and settings for this module if needed .