/** * Checks for conflicted exclusions. */ protected function checkExclusions() { $excludedPackages = $this->packageArchive->getConflictedExcludedPackages(); if (count($excludedPackages) > 0) { // this package exludes existing packages -> stop installation WCF::getTPL()->assign(array('excludedPackages' => $excludedPackages)); WCF::getTPL()->display('packageInstallationExcludedPackages'); exit; } $excludingPackages = $this->packageArchive->getConflictedExcludingPackages(); if (count($excludingPackages) > 0) { $stop = 1; // this package is excluded by existing packages $sql = "SELECT\t*\n\t\t\t\tFROM\twcf" . WCF_N . "_package_installation_queue\n\t\t\t\tWHERE\tprocessNo = " . $this->processNo . "\n\t\t\t\t\tAND packageID IN (" . implode(',', array_keys($excludingPackages)) . ")"; $result = WCF::getDB()->sendQuery($sql); while ($row = WCF::getDB()->fetchArray($result)) { $archive = new PackageArchive($row['archive']); $archive->openArchive(); $newExclusions = $archive->getExcludedPackages(); if (!count($newExclusions) || !isset($newExclusions[$this->packageArchive->getPackageInfo('name')]) || isset($newExclusions[$this->packageArchive->getPackageInfo('name')]['version']) && Package::compareVersion($this->packageArchive->getPackageInfo('version'), $newExclusions[$this->packageArchive->getPackageInfo('name')]['version'], '<')) { unset($excludingPackages[$row['packageID']]); $stop = 0; } } if (count($excludingPackages) > 0) { WCF::getTPL()->assign(array('excludingPackages' => $excludingPackages, 'stop' => $stop, 'nextStep' => 'package')); WCF::getTPL()->display('packageInstallationExcludingPackages'); exit; } } }
/** * Gets the package name of the first standalone application in WCFSetup.tar.gz. */ protected static function getPackageName() { // get package name $tar = new Tar(SETUP_FILE); foreach ($tar->getContentList() as $file) { if ($file['type'] != 'folder' && StringUtil::indexOf($file['filename'], 'install/packages/') === 0) { $packageFile = basename($file['filename']); $packageName = preg_replace('!\\.(tar\\.gz|tgz|tar)$!', '', $packageFile); if ($packageName != 'com.woltlab.wcf') { try { $archive = new PackageArchive(TMP_DIR . TMP_FILE_PREFIX . $packageFile); $archive->openArchive(); self::$setupPackageName = $archive->getPackageInfo('packageName'); $archive->getTar()->close(); break; } catch (SystemException $e) { } } } } $tar->close(); // assign package name WCF::getTPL()->assign('setupPackageName', self::$setupPackageName); }