diff options
author | Marc Alexander <admin@m-a-styles.de> | 2014-11-21 18:08:22 +0100 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2014-11-21 21:37:43 +0100 |
commit | f6e7a94bd55c1c3b7a8aaed370a728c58ac34ea6 (patch) | |
tree | 83d2d1260e17559fa7382ff222c432d015e4a6af /phpBB | |
parent | 2793f9c078272b178250ed4e0812219b9c5c1676 (diff) | |
download | forums-f6e7a94bd55c1c3b7a8aaed370a728c58ac34ea6.tar forums-f6e7a94bd55c1c3b7a8aaed370a728c58ac34ea6.tar.gz forums-f6e7a94bd55c1c3b7a8aaed370a728c58ac34ea6.tar.bz2 forums-f6e7a94bd55c1c3b7a8aaed370a728c58ac34ea6.tar.xz forums-f6e7a94bd55c1c3b7a8aaed370a728c58ac34ea6.zip |
[ticket/13358] Use file_downloader in get_remote_file()
get_remote_file() has been marked as deprecated.
PHPBB3-13358
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/functions_admin.php | 65 |
1 files changed, 8 insertions, 57 deletions
diff --git a/phpBB/includes/functions_admin.php b/phpBB/includes/functions_admin.php index 5ddaf31cf5..6f95bc13bd 100644 --- a/phpBB/includes/functions_admin.php +++ b/phpBB/includes/functions_admin.php @@ -2982,68 +2982,19 @@ function get_database_size() /** * Retrieve contents from remotely stored file +* +* @deprecated 3.1.2 Use file_downloader instead */ function get_remote_file($host, $directory, $filename, &$errstr, &$errno, $port = 80, $timeout = 6) { - global $user; - - if ($fsock = @fsockopen($host, $port, $errno, $errstr, $timeout)) - { - @fputs($fsock, "GET $directory/$filename HTTP/1.0\r\n"); - @fputs($fsock, "HOST: $host\r\n"); - @fputs($fsock, "Connection: close\r\n\r\n"); - - $timer_stop = time() + $timeout; - stream_set_timeout($fsock, $timeout); - - $file_info = ''; - $get_info = false; - - while (!@feof($fsock)) - { - if ($get_info) - { - $file_info .= @fread($fsock, 1024); - } - else - { - $line = @fgets($fsock, 1024); - if ($line == "\r\n") - { - $get_info = true; - } - else if (stripos($line, '404 not found') !== false) - { - $errstr = $user->lang('FILE_NOT_FOUND', $filename); - return false; - } - } - - $stream_meta_data = stream_get_meta_data($fsock); + global $phpbb_container; - if (!empty($stream_meta_data['timed_out']) || time() >= $timer_stop) - { - $errstr = $user->lang['FSOCK_TIMEOUT']; - return false; - } - } - @fclose($fsock); - } - else - { - if ($errstr) - { - $errstr = utf8_convert_message($errstr); - return false; - } - else - { - $errstr = $user->lang['FSOCK_DISABLED']; - return false; - } - } + // Get file downloader and assign $errstr and $errno + $file_downloader = $phpbb_container->get('file_downloader') + ->set_error_string($errstr) + ->set_error_number($errno); - return $file_info; + return $file_downloader->get($host, $directory, $filename, $port, $timeout); } /* |