/**
  * Deactivates module.
  *
  * @param oxModule $oModule
  * @param string   $sModuleId
  */
 protected function deactivateModule($oModule, $sModuleId = null)
 {
     if ($sModuleId) {
         $oModule->load($sModuleId);
     }
     $oModuleCache = oxNew('oxModuleCache', $oModule);
     $oModuleInstaller = oxNew('oxModuleInstaller', $oModuleCache);
     $oModuleInstaller->deactivate($oModule);
 }
 /**
  * Check if all module files exists in shop.
  *
  * @param oxModule $oModule module object
  *
  * @return bool
  */
 private function _moduleFilesInformationExistInShop(oxModule $oModule)
 {
     $aModuleFiles = $oModule->getFiles();
     /** @var oxModuleList $oModuleList */
     $oModuleList = oxNew('oxModuleList');
     $aShopInformationAboutModulesFiles = $oModuleList->getModuleFiles();
     $aMissingFiles = array_diff($aModuleFiles, $aShopInformationAboutModulesFiles);
     return count($aMissingFiles) === 0;
 }
 /**
  * Get active module object.
  *
  * @return oxModule
  */
 public function getModule()
 {
     if ($this->_oModule === null) {
         $sModuleId = $this->getEditObjectId();
         $this->_aViewData['oxid'] = $sModuleId;
         $this->_oModule = oxNew('oxModule');
         $this->_oModule->load($sModuleId);
     }
     return $this->_oModule;
 }
 /**
  * Fix module states task runs version, extend, files, templates, blocks,
  * settings and events information fix tasks
  *
  * @param oxModule      $oModule
  * @param oxConfig|null $oConfig If not passed uses default base shop config
  */
 public function fix(oxModule $oModule, oxConfig $oConfig = null)
 {
     if ($oConfig !== null) {
         $this->setConfig($oConfig);
     }
     $sModuleId = $oModule->getId();
     $this->_deleteBlock($sModuleId);
     $this->_deleteTemplateFiles($sModuleId);
     $this->_deleteModuleFiles($sModuleId);
     $this->_deleteModuleEvents($sModuleId);
     $this->_deleteModuleVersions($sModuleId);
     $this->_addExtensions($oModule);
     $this->_addTemplateBlocks($oModule->getInfo("blocks"), $sModuleId);
     $this->_addModuleFiles($oModule->getInfo("files"), $sModuleId);
     $this->_addTemplateFiles($oModule->getInfo("templates"), $sModuleId);
     $this->_addModuleSettings($oModule->getInfo("settings"), $sModuleId);
     $this->_addModuleVersion($oModule->getInfo("version"), $sModuleId);
     $this->_addModuleEvents($oModule->getInfo("events"), $sModuleId);
     /** @var oxModuleCache $oModuleCache */
     $oModuleCache = oxNew('oxModuleCache', $oModule);
     $oModuleCache->resetCache();
 }
 /**
  * Validates module metadata.
  * Return true if module metadata is valid.
  * Return false if module metadata is not valid, or if metadata file does not exist.
  *
  * @param oxModule $oModule object to validate metadata.
  *
  * @return bool
  */
 public function validate(oxModule $oModule)
 {
     $sMetadataPath = $oModule->getMetadataPath();
     return file_exists($sMetadataPath);
 }
Beispiel #6
0
 /**
  * Removes garbage ( module not used extensions ) from all installed extensions list
  *
  * @param array    $aInstalledExtensions Installed extensions
  * @param oxModule $oModule              Module
  *
  * @return array
  */
 protected function _removeNotUsedExtensions($aInstalledExtensions, oxModule $oModule)
 {
     $aModuleExtensions = $oModule->getExtensions();
     $aInstalledModuleExtensions = $this->_filterModuleArray($aInstalledExtensions, $oModule->getId());
     if (count($aInstalledModuleExtensions)) {
         $aGarbage = $this->_getModuleExtensionsGarbage($aModuleExtensions, $aInstalledModuleExtensions);
         if (count($aGarbage)) {
             $aInstalledExtensions = $this->_removeGarbage($aInstalledExtensions, $aGarbage);
         }
     }
     return $aInstalledExtensions;
 }
 /**
  * Return true if all module independent PHP files exist.
  *
  * @param oxModule $oModule object to validate metadata.
  *
  * @return mixed
  */
 protected function _allModuleFilesExists($oModule)
 {
     $aModuleExtendedFiles = $oModule->getFiles();
     $blAllModuleFilesExists = $this->_allFilesExists($aModuleExtendedFiles);
     return $blAllModuleFilesExists;
 }
Beispiel #8
0
 /**
  * Deactivate sR Unit OXID module
  */
 protected function deactivateModule()
 {
     $module = new \oxModule();
     $module->load('srunit');
     if ($module->isActive()) {
         $module->deactivate();
     }
 }
 /**
  * @param oxModule $oModule
  * @return bool
  * @throws oxException
  */
 public function deactivate(oxModule $oModule)
 {
     $blResult = false;
     $sModuleId = $oModule->getId();
     if ($sModuleId) {
         $oModuleList = oxNew("oxModuleList");
         $aModules = $oModuleList->getActiveModuleInfo();
         foreach ($aModules as $sActiveModule => $sPath) {
             $oSubModule = oxNew("oxModule");
             $oSubModule->load($sActiveModule);
             $aDeps = $oSubModule->getDependencies();
             if (array_key_exists($sModuleId, $aDeps)) {
                 $blIsActive = $oSubModule->isActive();
                 if ($blIsActive == true) {
                     $oLang = oxRegistry::getLang();
                     $sMessage = $oLang->translateString("ib_DependencyManager_DEP_ACTIVE");
                     $sTranslatedMessage = sprintf($sMessage, $sActiveModule);
                     $oException = new oxException($sTranslatedMessage);
                     throw $oException;
                     break;
                 }
             }
         }
         $blResult = parent::deactivate($oModule);
     }
     return $blResult;
 }