Remove PackageArchive::unzipPackageArchive()
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 10 Aug 2022 09:02:15 +0000 (11:02 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 10 Aug 2022 10:28:34 +0000 (12:28 +0200)
The `Tar` class is perfectly able to handle compressed tar archives, no need to
explicitly extract.

wcfsetup/install/files/lib/system/package/PackageArchive.class.php

index 5ccbaf6c46a2826dbfa9e594305a614aeec2db57..8120a1441f1479f2104ac7e418654ce84340a3a8 100644 (file)
@@ -503,10 +503,7 @@ class PackageArchive
         }
         $file->close();
 
-        // unzip tar
-        $this->archive = self::unzipPackageArchive($tmpFile);
-
-        return $this->archive;
+        return $tmpFile;
     }
 
     /**
@@ -904,28 +901,6 @@ class PackageArchive
         return $filename;
     }
 
-    /**
-     * Unzips compressed package archives and returns the temporary file name.
-     *
-     * @param string $archive filename
-     * @return  string
-     */
-    public static function unzipPackageArchive($archive)
-    {
-        if (!FileUtil::isURL($archive)) {
-            $tar = new Tar($archive);
-            $tar->close();
-            if ($tar->isZipped()) {
-                $tmpName = FileUtil::getTemporaryFilename('package_');
-                if (FileUtil::uncompressFile($archive, $tmpName)) {
-                    return $tmpName;
-                }
-            }
-        }
-
-        return $archive;
-    }
-
     /**
      * Returns a list of packages which exclude this package.
      *