From 1d9fd26a6f6a56b4fd4073fdcd49b042b22805bf Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 19 Aug 2011 15:26:28 +0200 Subject: [PATCH] Non-archives won't be recognized as archives any more --- .../files/lib/system/WCFSetup.class.php | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/wcfsetup/install/files/lib/system/WCFSetup.class.php b/wcfsetup/install/files/lib/system/WCFSetup.class.php index 3048dbab48..2f5a6129ab 100644 --- a/wcfsetup/install/files/lib/system/WCFSetup.class.php +++ b/wcfsetup/install/files/lib/system/WCFSetup.class.php @@ -954,22 +954,26 @@ class WCFSetup extends WCF { 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') { - $wcfPackageFile = $packageFile; - } - else { - $isStrato = (!empty($_SERVER['DOCUMENT_ROOT']) && (strpos($_SERVER['DOCUMENT_ROOT'], 'strato') !== false)); - if (!$isStrato && preg_match('!\.(tar\.gz|tgz)$!', $packageFile)) { - // try to unzip zipped package files - if (FileUtil::uncompressFile(TMP_DIR.'install/packages/'.$packageFile, TMP_DIR.'install/packages/'.$packageName.'.tar')) { - @unlink(TMP_DIR.'install/packages/'.$packageFile); - $packageFile = $packageName.'.tar'; + // ignore any files which aren't an archive + if (preg_match('~\.(tar\.gz|tgz|tar)$~', $packageFile)) { + $packageName = preg_replace('!\.(tar\.gz|tgz|tar)$!', '', $packageFile); + + if ($packageName == 'com.woltlab.wcf') { + $wcfPackageFile = $packageFile; + } + else { + $isStrato = (!empty($_SERVER['DOCUMENT_ROOT']) && (strpos($_SERVER['DOCUMENT_ROOT'], 'strato') !== false)); + if (!$isStrato && preg_match('!\.(tar\.gz|tgz)$!', $packageFile)) { + // try to unzip zipped package files + if (FileUtil::uncompressFile(TMP_DIR.'install/packages/'.$packageFile, TMP_DIR.'install/packages/'.$packageName.'.tar')) { + @unlink(TMP_DIR.'install/packages/'.$packageFile); + $packageFile = $packageName.'.tar'; + } } + + $otherPackages[$packageName] = $packageFile; } - - $otherPackages[$packageName] = $packageFile; } } } -- 2.20.1