aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/version_helper.php
diff options
context:
space:
mode:
authorKilian <kilian@mirdan.de>2015-09-25 21:06:13 +0200
committerKilian <kilian@mirdan.de>2015-09-25 22:16:29 +0200
commit30279347acf62e6e39eea7bf56b46e48e2170ddc (patch)
tree0a10ec67a6ebb6f027e1553fdc91e927a1458f73 /phpBB/phpbb/version_helper.php
parent7e379c4cea5452dad81adbc508b205badf49d25f (diff)
downloadforums-30279347acf62e6e39eea7bf56b46e48e2170ddc.tar
forums-30279347acf62e6e39eea7bf56b46e48e2170ddc.tar.gz
forums-30279347acf62e6e39eea7bf56b46e48e2170ddc.tar.bz2
forums-30279347acf62e6e39eea7bf56b46e48e2170ddc.tar.xz
forums-30279347acf62e6e39eea7bf56b46e48e2170ddc.zip
[ticket/12618] Allow extension author to use SSL for version-check
For version-check a new parameter 'ssl' is introduced. If set to true, it will use 443 as port for the file_downloader. In file_downloader, the host parameter of fsockopen is appended with 'ssl://' in case the port is 443 in order to use SSL. PHPBB3-12618
Diffstat (limited to 'phpBB/phpbb/version_helper.php')
-rw-r--r--phpBB/phpbb/version_helper.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/phpBB/phpbb/version_helper.php b/phpBB/phpbb/version_helper.php
index e4f68f5aab..a1e66ba8fe 100644
--- a/phpBB/phpbb/version_helper.php
+++ b/phpBB/phpbb/version_helper.php
@@ -34,6 +34,11 @@ class version_helper
protected $file = 'versions.json';
/**
+ * @var bool Use SSL or not
+ */
+ protected $use_ssl = false;
+
+ /**
* @var string Current version installed
*/
protected $current_version;
@@ -85,13 +90,15 @@ class version_helper
* @param string $host Host (e.g. version.phpbb.com)
* @param string $path Path to file (e.g. /phpbb)
* @param string $file File name (Default: versions.json)
+ * @param bool $use_ssl Use SSL or not (Default: false)
* @return version_helper
*/
- public function set_file_location($host, $path, $file = 'versions.json')
+ public function set_file_location($host, $path, $file = 'versions.json', $use_ssl = false)
{
$this->host = $host;
$this->path = $path;
$this->file = $file;
+ $this->use_ssl = $use_ssl;
return $this;
}
@@ -244,7 +251,7 @@ class version_helper
*/
public function get_versions($force_update = false, $force_cache = false)
{
- $cache_file = '_versioncheck_' . $this->host . $this->path . $this->file;
+ $cache_file = '_versioncheck_' . $this->host . $this->path . $this->file . $this->use_ssl;
$info = $this->cache->get($cache_file);
@@ -255,7 +262,7 @@ class version_helper
else if ($info === false || $force_update)
{
try {
- $info = $this->file_downloader->get($this->host, $this->path, $this->file);
+ $info = $this->file_downloader->get($this->host, $this->path, $this->file, $this->use_ssl ? 443 : 80);
}
catch (\phpbb\exception\runtime_exception $exception)
{