/** * Return pack metadata * * @return array */ public function getMetadata() { return parent::getMetadata() + array(self::METADATA_FIELD_VERSION_MAJOR => \XLite::getInstance()->getMajorVersion(), self::METADATA_FIELD_VERSION_MINOR => \XLite::getInstance()->getMinorVersion()); }
/** * Return pack metadata * * @return array */ public function getMetadata() { return parent::getMetadata() + array(self::METADATA_FIELD_ACTUAL_NAME => $this->module->getActualName(), self::METADATA_FIELD_VERSION_MAJOR => $this->module->callModuleMethod('getMajorVersion'), self::METADATA_FIELD_VERSION_MINOR => $this->module->callModuleMethod('getMinorVersion'), self::METADATA_FIELD_NAME => $this->module->callModuleMethod('getModuleName'), self::METADATA_FIELD_AUTHOR => $this->module->callModuleMethod('getAuthorName'), self::METADATA_FIELD_ICON_LINK => $this->module->callModuleMethod('getIconURL'), self::METADATA_FIELD_DESCRIPTION => $this->module->callModuleMethod('getDescription'), self::METADATA_FIELD_DEPENDENCIES => $this->module->callModuleMethod('getDependencies'), self::METADATA_FIELD_IS_SYSTEM => $this->module->callModuleMethod('isSystem')); }
/** * Download pack * * @param \XLite\Core\Pack\APack $pack Files to pack * @param boolean $compress Flag OPTIONAL * * @return void */ protected static function download(\XLite\Core\Pack\APack $pack, $compress = true) { if (!\Includes\Utils\FileManager::isDir(LC_DIR_TMP)) { \Includes\Utils\FileManager::mkdir(LC_DIR_TMP); } if (!\Includes\Utils\FileManager::isDirWriteable(LC_DIR_TMP)) { \Includes\ErrorHandler::fireError('Directory "' . LC_DIR_TMP . '" is not writeable'); } $path = LC_DIR_TMP . $pack->getName() . '.tar'; $phar = static::pack($path, $pack->getDirectoryIterator(), $pack->getMetadata(), $compress); header('Content-Type: application/force-download'); header('Content-Disposition: attachment; filename="' . basename($path) . '"'); header('Content-Length: ' . filesize($path)); echo \Includes\Utils\FileManager::read($path); \Includes\Utils\FileManager::deleteFile($path); exit(0); }