HEX
Server: Apache
System: Linux srv13.cpanelhost.cl 3.10.0-962.3.2.lve1.5.38.el7.x86_64 #1 SMP Thu Jun 18 05:28:41 EDT 2020 x86_64
User: cca63905 (4205)
PHP: 7.3.20
Disabled: NONE
Upload Files
File: //proc/self/root/proc/self/cwd/nueva/modules/ps_accounts/src/Service/UpgradeService.php
<?php

namespace PrestaShop\Module\PsAccounts\Service;

use PrestaShop\Module\PsAccounts\Repository\ConfigurationRepository;

class UpgradeService
{
    const MODULE_NAME = 'ps_accounts';

    /**
     * @var ConfigurationRepository
     */
    private $repository;

    /**
     * @param ConfigurationRepository $configurationRepository
     */
    public function __construct(ConfigurationRepository $configurationRepository)
    {
        $this->repository = $configurationRepository;
    }

    /**
     * @return string
     */
    public function getVersion()
    {
        $version = $this->getRegisteredVersion();

        if ($version === '0') {
            $version = $this->getCoreRegisteredVersion();
        }

        return $version;
    }

    /**
     * @param string $version
     *
     * @return void
     */
    public function setVersion($version = \Ps_accounts::VERSION)
    {
        $this->repository->updateLastUpgrade($version);
    }

    /**
     * @return string
     */
    public function getRegisteredVersion()
    {
        return $this->repository->getLastUpgrade(false);
    }

    /**
     * @return string
     */
    public function getCoreRegisteredVersion()
    {
        return \Db::getInstance()->getValue(
            'SELECT version FROM ' . _DB_PREFIX_ . 'module WHERE name = \'' . self::MODULE_NAME . '\''
        ) ?: '0';
    }
}