Moved supportsSSL() from HTTPRequest to RemoteFile
authorAlexander Ebert <ebert@woltlab.com>
Mon, 15 Dec 2014 12:57:00 +0000 (13:57 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 15 Dec 2014 12:57:00 +0000 (13:57 +0100)
wcfsetup/install/files/lib/data/package/PackageAction.class.php
wcfsetup/install/files/lib/system/io/RemoteFile.class.php
wcfsetup/install/files/lib/util/HTTPRequest.class.php

index 70fd45f324b86ddbabda053e30c64b2fec29fc5c..51768848ea077a1e702a87cdbdc544af86b9ebd4 100644 (file)
@@ -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<string>
         */
        public function searchForPurchasedItems() {
-               if (!HTTPRequest::supportSSL()) {
+               if (!RemoteFile::supportsSSL()) {
                        return array(
                                'noSSL' => WCF::getLanguage()->get('wcf.acp.pluginStore.api.noSSL')
                        );
index 4ff441d42c0d00f125dd834748caaa0ab30b4533..da47f6a84321440e504e625d6e37948f0fffae98 100644 (file)
@@ -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;
+       }
 }
index c1a02bfc283dda5083f5a25e19a3c24c48467d81..867eb942bd7819b34717bab9ec78935c2e220ab6 100644 (file)
@@ -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;
-       }
 }