Non-archives won't be recognized as archives any more
authorAlexander Ebert <ebert@woltlab.com>
Fri, 19 Aug 2011 13:26:28 +0000 (15:26 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 19 Aug 2011 13:26:28 +0000 (15:26 +0200)
wcfsetup/install/files/lib/system/WCFSetup.class.php

index 3048dbab48016034b34865431b0cc04a85d42e7b..2f5a6129abba8a0a3f2f73684a71de08e5c5f960 100644 (file)
@@ -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;
                                }
                        }
                }