]> git.mxchange.org Git - friendica.git/commitdiff
ping.php performance: caching baseurl
authorHypolite Petovan <ben.lort@gmail.com>
Fri, 28 Oct 2016 09:51:39 +0000 (05:51 -0400)
committerHypolite Petovan <ben.lort@gmail.com>
Fri, 28 Oct 2016 09:51:39 +0000 (05:51 -0400)
boot.php

index e49ffbd221e0f346ddf2319bfe9446c725b5c509..4fefe6f7edd1f868fa2c89a62f2144899b0e978b 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -787,27 +787,29 @@ class App {
                if (!is_object($this))
                        return(self::$a->get_baseurl($ssl));
 
-               $scheme = $this->scheme;
+               if (!$this->baseurl) {
+                       $scheme = $this->scheme;
 
-               if((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) {
-                       if(intval($this->config['system']['ssl_policy']) === intval(SSL_POLICY_FULL))
-                               $scheme = 'https';
+                       if((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) {
+                               if(intval($this->config['system']['ssl_policy']) === intval(SSL_POLICY_FULL))
+                                       $scheme = 'https';
 
-                       //      Basically, we have $ssl = true on any links which can only be seen by a logged in user
-                       //      (and also the login link). Anything seen by an outsider will have it turned off.
+                               //      Basically, we have $ssl = true on any links which can only be seen by a logged in user
+                               //      (and also the login link). Anything seen by an outsider will have it turned off.
 
-                       if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) {
-                               if($ssl)
-                                       $scheme = 'https';
-                               else
-                                       $scheme = 'http';
+                               if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) {
+                                       if($ssl)
+                                               $scheme = 'https';
+                                       else
+                                               $scheme = 'http';
+                               }
                        }
-               }
 
-               if (get_config('config','hostname') != "")
-                       $this->hostname = get_config('config','hostname');
+                       if (get_config('config','hostname') != "")
+                               $this->hostname = get_config('config','hostname');
 
-               $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
+                       $this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
+               }
                return $this->baseurl;
        }