From 086d43f26d047f7078762585ce95c75ad155a6ba Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Mon, 31 Oct 2016 18:42:19 +0100 Subject: [PATCH] Move to non-static version The static version is used nowhere in the code and just decreases coverage Signed-off-by: Lukas Reschke --- lib/private/Archive/Archive.php | 21 +-------------------- lib/private/Installer.php | 3 ++- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/lib/private/Archive/Archive.php b/lib/private/Archive/Archive.php index da2c53f2aa..fadc12d2a2 100644 --- a/lib/private/Archive/Archive.php +++ b/lib/private/Archive/Archive.php @@ -32,26 +32,7 @@ namespace OC\Archive; -abstract class Archive{ - /** - * Open any of the supported archive types - * - * @param string $path - * @return Archive|void - */ - public static function open($path) { - $mime = \OC::$server->getMimeTypeDetector()->detect($path); - - switch($mime) { - case 'application/zip': - return new ZIP($path); - case 'application/x-gzip': - return new TAR($path); - case 'application/x-bzip2': - return new TAR($path); - } - } - +abstract class Archive { /** * @param $source */ diff --git a/lib/private/Installer.php b/lib/private/Installer.php index 67c949bc13..120992d3e6 100644 --- a/lib/private/Installer.php +++ b/lib/private/Installer.php @@ -46,6 +46,7 @@ use OC\App\CodeChecker\CodeChecker; use OC\App\CodeChecker\EmptyCheck; use OC\App\CodeChecker\PrivateCheck; use OC\Archive\Archive; +use OC\Archive\TAR; use OC_App; use OC_DB; use OC_Helper; @@ -254,7 +255,7 @@ class Installer { if($verified === true) { // Seems to match, let's proceed $extractDir = $this->tempManager->getTemporaryFolder(); - $archive = Archive::open($tempFile); + $archive = new TAR($tempFile); if($archive) { $archive->extract($extractDir);