From: Alexander Ebert Date: Mon, 15 Dec 2014 12:57:00 +0000 (+0100) Subject: Moved supportsSSL() from HTTPRequest to RemoteFile X-Git-Tag: 2.1.0_Beta_2~37 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=e7714ce11add5709e2f61fa9553ce2fbd977d19f;p=GitHub%2FWoltLab%2FWCF.git Moved supportsSSL() from HTTPRequest to RemoteFile --- diff --git a/wcfsetup/install/files/lib/data/package/PackageAction.class.php b/wcfsetup/install/files/lib/data/package/PackageAction.class.php index 70fd45f324..51768848ea 100644 --- a/wcfsetup/install/files/lib/data/package/PackageAction.class.php +++ b/wcfsetup/install/files/lib/data/package/PackageAction.class.php @@ -3,10 +3,11 @@ namespace wcf\data\package; use wcf\data\AbstractDatabaseObjectAction; use wcf\system\database\util\PreparedStatementConditionBuilder; use wcf\system\exception\SystemException; +use wcf\system\io\RemoteFile; use wcf\system\request\LinkHandler; use wcf\system\WCF; -use wcf\util\HTTPRequest; use wcf\util\JSON; +use wcf\util\HTTPRequest; /** * Executes package-related actions. @@ -79,7 +80,7 @@ class PackageAction extends AbstractDatabaseObjectAction { * @return array */ public function searchForPurchasedItems() { - if (!HTTPRequest::supportSSL()) { + if (!RemoteFile::supportsSSL()) { return array( 'noSSL' => WCF::getLanguage()->get('wcf.acp.pluginStore.api.noSSL') ); diff --git a/wcfsetup/install/files/lib/system/io/RemoteFile.class.php b/wcfsetup/install/files/lib/system/io/RemoteFile.class.php index 4ff441d42c..da47f6a843 100644 --- a/wcfsetup/install/files/lib/system/io/RemoteFile.class.php +++ b/wcfsetup/install/files/lib/system/io/RemoteFile.class.php @@ -37,6 +37,12 @@ class RemoteFile extends File { */ protected $errorDesc = ''; + /** + * true if PHP supports SSL/TLS + * @var boolean + */ + private static $hasSSLSupport = null; + /** * Opens a new connection to a remote host. * @@ -94,4 +100,25 @@ class RemoteFile extends File { public function hasTLSSupport() { return function_exists('stream_socket_enable_crypto'); } + + /** + * Returns true if PHP supports SSL/TLS. + * + * @return boolean + */ + public static function supportsSSL() { + if (static::$hasSSLSupport === null) { + static::$hasSSLSupport = false; + + $transports = stream_get_transports(); + foreach ($transports as $transport) { + if (preg_match('~^(ssl(v[23])?|tls(v[0-9\.]+)?)$~', $transport)) { + static::$hasSSLSupport = true; + break; + } + } + } + + return static::$hasSSLSupport; + } } diff --git a/wcfsetup/install/files/lib/util/HTTPRequest.class.php b/wcfsetup/install/files/lib/util/HTTPRequest.class.php index c1a02bfc28..867eb942bd 100644 --- a/wcfsetup/install/files/lib/util/HTTPRequest.class.php +++ b/wcfsetup/install/files/lib/util/HTTPRequest.class.php @@ -128,12 +128,6 @@ final class HTTPRequest { */ private $statusCode = 0; - /** - * true if PHP supports SSL/TLS - * @var boolean - */ - private static $hasSSLSupport = null; - /** * Constructs a new instance of HTTPRequest. * @@ -607,25 +601,4 @@ final class HTTPRequest { $this->replyBody = ''; $this->statusCode = 0; } - - /** - * Returns true if PHP supports SSL/TLS. - * - * @return boolean - */ - public static function supportSSL() { - if (static::$hasSSLSupport === null) { - static::$hasSSLSupport = false; - - $transports = stream_get_transports(); - foreach ($transports as $transport) { - if (preg_match('~^(ssl(v[23])?|tls(v[0-9\.]+)?)$~', $transport)) { - static::$hasSSLSupport = true; - break; - } - } - } - - return static::$hasSSLSupport; - } }