Ejemplo n.º 1
0
 /**
  * Return info block html
  * @param  \Magento\Framework\Data\Form\Element\AbstractElement $element
  * @return string
  */
 public function render(\Magento\Framework\Data\Form\Element\AbstractElement $element)
 {
     $m = $this->moduleList->getOne($this->getModuleName());
     $html = '<div style="padding:10px;background-color:#f8f8f8;border:1px solid #ddd;margin-bottom:7px;">
         Login As Customer Extension v' . $m['setup_version'] . ' was developed by <a href="http://magefan.com/" target="_blank">MageFan</a>.
     </div>';
     return $html;
 }
Ejemplo n.º 2
0
 /**
  * Magento version
  *
  * @return string
  */
 public function getVersion()
 {
     $module = $this->moduleList->getOne('Magento_Backend');
     if (is_array($module) && isset($module['setup_version'])) {
         return $module['setup_version'];
     }
     return '2.0.0';
 }
Ejemplo n.º 3
0
 /**
  * Constructor
  *
  * @param LoggerInterface $log
  * @param ModuleListInterface $moduleList
  * @param SetupFileResolver $fileResolver
  * @param string $moduleName
  * @param \Magento\Framework\App\Resource $resource
  * @param string $connectionName
  */
 public function __construct(LoggerInterface $log, ModuleListInterface $moduleList, SetupFileResolver $fileResolver, $moduleName, \Magento\Framework\App\Resource $resource, $connectionName = SetupInterface::DEFAULT_SETUP_CONNECTION)
 {
     parent::__construct($resource, $connectionName);
     $this->logger = $log;
     $this->fileResolver = $fileResolver;
     $this->moduleConfig = $moduleList->getOne($moduleName);
     $this->resource = new Resource($resource);
     $this->resourceName = $this->fileResolver->getResourceCode($moduleName);
 }
Ejemplo n.º 4
0
 /**
  * Check if DB data is up to date
  *
  * @param string $moduleName
  * @param string|bool $version
  * @return bool
  * @throws \UnexpectedValueException
  */
 private function isModuleVersionEqual($moduleName, $version)
 {
     $module = $this->moduleList->getOne($moduleName);
     if (empty($module['setup_version'])) {
         throw new \UnexpectedValueException("Setup version for module '{$moduleName}' is not specified");
     }
     $configVer = $module['setup_version'];
     return $version !== false && version_compare($configVer, $version) === ModuleDataSetupInterface::VERSION_COMPARE_EQUAL;
 }
Ejemplo n.º 5
0
 /**
  * Getting the version of Magento and the version of the extension
  * @return array
  */
 protected function getVersions()
 {
     $version = array();
     $productMetadata = $this->_objectManager->get('\\Magento\\Framework\\App\\ProductMetadata');
     $version['storePlatformVersion'] = $productMetadata->getVersion();
     $version['signifydClientApp'] = 'Magento 2';
     $version['storePlatform'] = 'Magento 2';
     $version['signifydClientAppVersion'] = (string) $this->_moduleList->getOne('Signifyd_Connect')['setup_version'];
     return $version;
 }
Ejemplo n.º 6
0
 /**
  * get available modules
  *
  * @return array
  */
 public function getUmcModules()
 {
     $modules = $this->helpConfig->getConfig('module', true, []);
     $installed = [];
     foreach ($modules as $module) {
         $moduleData = $this->moduleList->getOne($module['id']);
         if ($moduleData) {
             $version = $moduleData['setup_version'];
             if (isset($module['build'])) {
                 $version .= '-' . $module['build'];
             }
             $installed[] = ['module' => $module['id'], 'version' => $version];
         }
     }
     return $installed;
 }
 /**
  * Get current connector version.
  *
  * @return mixed
  */
 public function getConnectorVersion()
 {
     return $this->moduleInterface->getOne(self::MODULE_NAME)['setup_version'];
 }
Ejemplo n.º 8
0
 private function getConfigVersion()
 {
     return $this->moduleList->getOne(Module::IDENTIFIER)['setup_version'];
 }
Ejemplo n.º 9
0
 /**
  * Get Module version number
  *
  * @return string
  */
 public function getVersion()
 {
     $moduleInfo = $this->_moduleList->getOne($this->getModuleName());
     return $moduleInfo['setup_version'];
 }
 public function getExtensionVersion()
 {
     $moduleCode = 'MagePsycho_Easypathhints';
     $moduleInfo = $this->_moduleList->getOne($moduleCode);
     return $moduleInfo['setup_version'];
 }
    /**
     * Handles database schema and data (install/upgrade/backup/uninstall etc)
     *
     * @param SchemaSetupInterface | ModuleDataSetupInterface $setup
     * @param string $type
     * @return void
     * @throws \Exception
     *
     * @SuppressWarnings(PHPMD.CyclomaticComplexity)
     * @SuppressWarnings(PHPMD.NPathComplexity)
     */
    private function handleDBSchemaData($setup, $type)
    {
        if (!(($type === 'schema') || ($type === 'data'))) {
            throw  new \Magento\Setup\Exception("Unsupported operation type $type is requested");
        }

        $this->assertDeploymentConfigExists();
        $this->assertDbAccessible();

        $resource = new \Magento\Framework\Module\ModuleResource($this->context);
        $verType = $type . '-version';
        $installType = $type . '-install';
        $upgradeType = $type . '-upgrade';
        $moduleNames = $this->moduleList->getNames();
        $moduleContextList = $this->generateListOfModuleContext($resource, $verType);
        foreach ($moduleNames as $moduleName) {
            $this->log->log("Module '{$moduleName}':");
            $configVer = $this->moduleList->getOne($moduleName)['setup_version'];
            $currentVersion = $moduleContextList[$moduleName]->getVersion();
            // Schema/Data is installed
            if ($currentVersion !== '') {
                $status = version_compare($configVer, $currentVersion);
                if ($status == \Magento\Framework\Setup\ModuleDataSetupInterface::VERSION_COMPARE_GREATER) {
                    $upgrader = $this->getSchemaDataHandler($moduleName, $upgradeType);
                    if ($upgrader) {
                        $this->log->logInline("Upgrading $type.. ");
                        $upgrader->upgrade($setup, $moduleContextList[$moduleName]);
                    }
                    if ($type === 'schema') {
                        $resource->setDbVersion($moduleName, $configVer);
                    } elseif ($type === 'data') {
                        $resource->setDataVersion($moduleName, $configVer);
                    }
                }
            } elseif ($configVer) {
                $installer = $this->getSchemaDataHandler($moduleName, $installType);
                if ($installer) {
                    $this->log->logInline("Installing $type.. ");
                    $installer->install($setup, $moduleContextList[$moduleName]);
                }
                $upgrader = $this->getSchemaDataHandler($moduleName, $upgradeType);
                if ($upgrader) {
                    $this->log->logInline("Upgrading $type.. ");
                    $upgrader->upgrade($setup, $moduleContextList[$moduleName]);
                }
                if ($type === 'schema') {
                    $resource->setDbVersion($moduleName, $configVer);
                } elseif ($type === 'data') {
                    $resource->setDataVersion($moduleName, $configVer);
                }
            }
            $this->logProgress();
        }

        if ($type === 'schema') {
            $this->log->log('Schema post-updates:');
            $handlerType = 'schema-recurring';
        } else if ($type === 'data') {
            $this->log->log('Data post-updates:');
            $handlerType = 'data-recurring';
        }
        foreach ($moduleNames as $moduleName) {
            $this->log->log("Module '{$moduleName}':");
            $modulePostUpdater = $this->getSchemaDataHandler($moduleName, $handlerType);
            if ($modulePostUpdater) {
                $this->log->logInline('Running ' + str_replace('-', ' ', $handlerType) + '...');
                $modulePostUpdater->install($setup, $moduleContextList[$moduleName]);
            }
            $this->logProgress();
        }
    }
Ejemplo n.º 12
0
 private function getConfigVersion()
 {
     return $this->moduleList->getOne(\Ess\M2ePro\Helper\Module::IDENTIFIER)['setup_version'];
 }
Ejemplo n.º 13
0
 public function getExtensionVersion()
 {
     $moduleCode = 'MagePsycho_Customshipping';
     $moduleInfo = $this->_moduleList->getOne($moduleCode);
     return $moduleInfo['setup_version'];
 }
Ejemplo n.º 14
0
 public function getModuleVersion()
 {
     return (string) $this->_moduleList->getOne("Adyen_Payment")['setup_version'];
 }