/** * Constructor * * @param \XLite\Model\Module $moduleInstalled Module model object * @param \XLite\Model\Module $moduleForUpgrade Module model object * * @return void */ public function __construct(\XLite\Model\Module $moduleInstalled, \XLite\Model\Module $moduleForUpgrade) { $this->moduleInfoInstalled = $this->getPreparedModuleInfo($moduleInstalled, false); $this->moduleInfoForUpgrade = $this->getPreparedModuleInfo($moduleForUpgrade, true); if (is_null($this->getModuleInstalled())) { \Includes\ErrorHandler::fireError('Module ["' . implode('", "', $this->moduleInfoInstalled) . '"] is not found in DB'); } if (is_null($this->getModuleForUpgrade())) { \Includes\ErrorHandler::fireError('Module ["' . implode('", "', $this->moduleInfoForUpgrade) . '"] is not found in DB' . ' or is not a marketplace module'); } parent::__construct(); }
/** * Overloaded constructor * * @param string $path Path to the module package * * @return void */ public function __construct($path) { if (!\Includes\Utils\FileManager::isFileReadable($path)) { \Includes\ErrorHandler::fireError('Unable to read module package: "' . $path . '"'); } $this->setRepositoryPath($path); $module = new \PharData($this->getRepositoryPath()); $this->metadata = $module->getMetaData(); if (empty($this->metadata)) { \Includes\ErrorHandler::fireError('Unable to read module metadata: "' . $path . '"'); } parent::__construct(); }