Example #1
0
 public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     $this->installer = $setup;
     $this->installer->startSetup();
     try {
         $this->installGeneral();
         $this->installEbay();
         $this->installAmazon();
     } catch (\Exception $exception) {
         return;
     }
     $this->installer->endSetup();
     $this->getConnection()->insert($this->getFullTableName('setup'), ['version_from' => NULL, 'version_to' => $this->getConfigVersion(), 'is_completed' => 1, 'update_date' => $this->helperFactory->getObject('Data')->getCurrentGmtDate(), 'create_date' => $this->helperFactory->getObject('Data')->getCurrentGmtDate()]);
     $this->helperFactory->getObject('Module\\Maintenance\\Setup')->disable();
 }
Example #2
0
 public function install(SchemaSetupInterface $setup, ModuleContextInterface $context)
 {
     if ($this->helperFactory->getObject('Module\\Maintenance\\Setup')->isEnabled()) {
         return;
     }
     $this->helperFactory->getObject('Module\\Maintenance\\Setup')->enable();
     $this->installer = $setup;
     $this->installer->startSetup();
     try {
         $this->installGeneral();
         $this->installEbay();
         $this->installAmazon();
     } catch (\Exception $exception) {
         return;
     }
     $this->installer->endSetup();
 }
Example #3
0
 public function upgrade(ModuleDataSetupInterface $setup, ModuleContextInterface $context)
 {
     if (!$this->isInstalled()) {
         return;
     }
     if ($this->helperFactory->getObject('Module\\Maintenance\\Setup')->isEnabled()) {
         return;
     }
     $this->installer = $setup;
     try {
         if (!$this->isNeedRollbackBackup() && !empty($this->getNotCompletedUpgrades())) {
             throw new Exception('There are some not completed previous upgrades');
         }
         $versionFrom = $this->prepareVersionFrom();
         $versionTo = $this->prepareVersionTo();
         if ($versionFrom == $versionTo) {
             return;
         }
         $this->helperFactory->getObject('Module\\Maintenance\\Setup')->enable();
         while ($upgradeEntity = $this->getUpgradeEntity($versionFrom, $versionTo, !empty($versionTo))) {
             if ($this->isNeedRollbackBackup()) {
                 $upgradeEntity->getBackup()->rollback();
                 $this->unsetIsNeedRollbackBackup();
             }
             $upgradeEntity->process();
             $versionFrom = $upgradeEntity->getVersionTo();
             $versionTo = null;
             $this->setResourceVersion($upgradeEntity->getVersionTo());
         }
         $this->helperFactory->getObject('Module\\Maintenance\\Setup')->disable();
         $this->setResourceVersion($this->getConfigVersion());
     } catch (\Exception $exception) {
         $this->helperFactory->getObject('Module\\Exception')->process($exception);
         return;
     }
 }
Example #4
0
 /**
  * @param $helperName
  * @param array $arguments
  * @return \Magento\Framework\App\Helper\AbstractHelper
  * @throws \Ess\M2ePro\Model\Exception\Logic
  */
 protected function getHelper($helperName, array $arguments = [])
 {
     return $this->helperFactory->getObject($helperName, $arguments);
 }