From f131814ca15322fa4d5cddb58b1f15e00948b0df Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 8 Aug 2022 16:42:24 +0200 Subject: [PATCH] Remove FileUtil::downloadFileFromHttp() This method is deprecated since roughly forever, has a super questionable API and even itself relies on the deprecated HTTPRequest API. Users really should migrate to Guzzle. Resolves #4373 --- .../install/files/lib/util/FileUtil.class.php | 33 ------------------- 1 file changed, 33 deletions(-) diff --git a/wcfsetup/install/files/lib/util/FileUtil.class.php b/wcfsetup/install/files/lib/util/FileUtil.class.php index f70fc488ec..8331a7c98a 100644 --- a/wcfsetup/install/files/lib/util/FileUtil.class.php +++ b/wcfsetup/install/files/lib/util/FileUtil.class.php @@ -391,39 +391,6 @@ final class FileUtil return StringUtil::formatNumeric(\round($byte, $precision)) . ' ' . $symbol; } - /** - * Downloads a package archive from an http URL and returns the path to - * the downloaded file. - * - * @param string $httpUrl - * @param string $prefix - * @param array $options - * @param array $postParameters - * @param array $headers empty array or a not initialized variable - * @return string - * @deprecated This method currently only is a wrapper around \wcf\util\HTTPRequest. Please use - * HTTPRequest from now on, as this method may be removed in the future. - */ - public static function downloadFileFromHttp( - $httpUrl, - $prefix = 'package', - array $options = [], - array $postParameters = [], - &$headers = [] - ) { - $request = new HTTPRequest($httpUrl, $options, $postParameters); - $request->execute(); - $reply = $request->getReply(); - - $newFileName = self::getTemporaryFilename($prefix . '_'); - \file_put_contents($newFileName, $reply['body']); // the file to write. - - $tmp = $reply['headers']; // copy variable, to avoid problems with the reference - $headers = $tmp; - - return $newFileName; - } - /** * Determines whether a file is text or binary by checking the first few bytes in the file. * The exact number of bytes is system dependent, but it is typically several thousand. -- 2.20.1