Пример #1
0
 /**
  * Define the actions with no secure token
  *
  * @return array
  */
 public static function defineFreeFormIdActions()
 {
     $list = parent::defineFreeFormIdActions();
     $list[] = 'clear_cache';
     $list[] = 'set_install';
     $list[] = 'unset_install';
     return $list;
 }
Пример #2
0
 /**
  * Check module is recently installed
  *
  * @param array|string $module Module
  *
  * @return boolean
  */
 protected function isMarked($module)
 {
     $result = false;
     if (static::SKIN_STANDARD !== $module && \XLite\Core\Request::getInstance()->recent) {
         $installedIds = \XLite\Controller\Admin\Base\AddonsList::getRecentlyInstalledModuleList();
         $result = in_array($module['module']->getModuleId(), $installedIds, false);
     }
     $moduleId = \XLite\Core\Request::getInstance()->moduleId;
     if ($moduleId) {
         if (static::SKIN_STANDARD === $module) {
             $result = static::SKIN_STANDARD === $moduleId;
         } else {
             $result = $this->getModuleId($module) === $moduleId;
         }
     }
     return $result;
 }
Пример #3
0
 /**
  * Install add-ons from marketplace
  *
  * @return void
  */
 protected function doActionInstallAddon()
 {
     \XLite\Upgrade\Cell::getInstance()->clear(true, true, !$this->isForce());
     \XLite\Controller\Admin\AddonsListMarketplace::cleanModulesToInstall();
     foreach (\XLite\Core\Request::getInstance()->moduleIds as $moduleId) {
         $module = \XLite\Core\Database::getRepo('XLite\\Model\\Module')->find($moduleId);
         if (!$module) {
             $this->showError(__FUNCTION__, static::t('invalid module ID passed: X', array('moduleId' => $moduleId)));
         } elseif (!$module->getFromMarketplace()) {
             $this->showError(__FUNCTION__, static::t('trying to install a non-marketplace module: X', array('name' => $module->getActualName())));
         } elseif (!\XLite\Upgrade\Cell::getInstance()->addMarketplaceModule($module, true)) {
             $this->showError(__FUNCTION__, static::t('unable to add module entry to the installation list: X', array('path' => $module->getActualName())));
         } else {
             \XLite\Controller\Admin\Base\AddonsList::storeRecentlyInstalledModules(array($module->getModuleID()));
             if ($this->isForce()) {
                 $this->setHardRedirect(true);
                 $this->setReturnURL($this->buildURL('upgrade', 'download', $this->getActionParamsCommon()));
             } elseif (!$this->isNextStepAvailable() || !$this->isFreeSpaceCheckAvailable()) {
                 $this->setHardRedirect(true);
                 $this->setReturnURL($this->buildURL('upgrade', '', $this->getActionParamsCommon()));
             }
         }
     }
 }
Пример #4
0
 /**
  * Return params list to use for search
  *
  * @return \XLite\Core\CommonCell
  */
 protected function getSearchCondition()
 {
     $result = parent::getSearchCondition();
     if ($this->isRecentlyInstalledPage()) {
         $result->{\XLite\Model\Repo\Module::P_MODULEIDS} = \XLite\Controller\Admin\Base\AddonsList::getRecentlyInstalledModuleList();
     } else {
         $result->{\XLite\Model\Repo\Module::P_INSTALLED} = true;
         $result->{\XLite\Model\Repo\Module::P_ISSYSTEM} = false;
         if (!isset(\XLite\Core\Request::getInstance()->clearCnd)) {
             $result->{\XLite\Model\Repo\Module::P_SUBSTRING} = $this->getSubstring();
         }
     }
     return $result;
 }
Пример #5
0
 /**
  * Perform some actions before redirect
  *
  * @param string $action Performed action
  *
  * @return void
  */
 protected function actionPostprocess($action)
 {
     parent::actionPostprocess($action);
     $this->setReturnURL($this->buildURL('addons_list_installed'));
 }
Пример #6
0
 /**
  * Update database records
  *
  * @return array
  */
 protected function updateDBRecords()
 {
     $this->setIsFreshInstall(!$this->isInstalled());
     $module = $this->getModuleInstalled() ?: new \XLite\Model\Module($this->getModuleData());
     $module->setDate(\XLite\Core\Converter::time());
     $module->setRevisionDate($this->getRevisionDate());
     $module->setPackSize($this->getPackSize());
     $module->setModuleName($this->getName());
     $module->setAuthorName($this->getAuthor());
     $module->setDescription($this->getDescription());
     $module->setIconURL($this->getIconURL());
     $module->setDependencies($this->getDependencies());
     $data = $this->getModuleData();
     unset($data['majorVersion']);
     unset($data['minorVersion']);
     $modules = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->findBy($data);
     foreach ($modules as $moduleOld) {
         if ($moduleOld) {
             if ($moduleOld->getMajorVersion() != $this->getMajorVersionNew() || $moduleOld->getMinorVersion() != $this->getMinorVersionNew()) {
                 $module->setYamlLoaded($moduleOld->getYamlLoaded());
                 \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->delete($moduleOld);
             }
         }
     }
     // Save changes in DB
     if ($module->getModuleID()) {
         $module->setMajorVersion($this->getMajorVersionNew());
         $module->setMinorVersion($this->getMinorVersionNew());
         \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->update($module);
     } else {
         $module->setEnabled(true);
         \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->insert($module);
     }
     \XLite\Controller\Admin\Base\AddonsList::storeRecentlyInstalledModules(array($module->getModuleID()));
 }