public function activateModule($sModuleId, $sShopId, $oOutput) { /** @var oxModuleInstaller $oModuleInstaller */ $oModuleInstaller = oxRegistry::get('oxModuleInstaller'); if ($sShopId) { $oConfig = oxSpecificShopConfig::get($sShopId); $oModuleInstaller->setConfig($oConfig); } $oxModuleList = oxNew('oxModuleList'); $oxModuleList->getModulesFromDir(oxRegistry::getConfig()->getModulesDir()); $aModules = $oxModuleList->getList(); /** @var oxModule $oModule */ $oModule = $aModules[$sModuleId]; if ($oModule == null) { $oOutput->writeLn("{$sModuleId} not found. choose from:"); $oOutput->writeLn(join("\n", array_keys($aModules))); return; } if ($oModule->isActive()) { $oOutput->writeLn("{$sModuleId} already active"); } else { $oModuleInstaller->activate($oModule); } }
/** * Parse and return shop config objects from input * * @return oxSpecificShopConfig[] * * @throws oxInputException */ protected function _parseShopConfigs() { $oInput = $this->getInput(); if ($oInput->hasOption(array('b', 'base-shop'))) { return array(oxRegistry::getConfig()); } if ($mShopId = $oInput->getOption('shop')) { if (is_bool($mShopId)) { // No value for option were passed /** @var oxInputException $oEx */ $oEx = oxNew('oxInputException'); $oEx->setMessage('Please specify shop id in option following this format --shop=<shop_id>'); throw $oEx; } if ($oConfig = oxSpecificShopConfig::get($mShopId)) { return array($oConfig); } /** @var oxInputException $oEx */ $oEx = oxNew('oxInputException'); $oEx->setMessage('Shop id does not exist'); throw $oEx; } return oxSpecificShopConfig::getAll(); }