ping.php performance: caching baseurl

This commit is contained in:
Hypolite Petovan 2016-10-28 05:51:39 -04:00
parent 5783f3b32d
commit 301fea8684
1 changed files with 19 additions and 17 deletions

View File

@ -787,27 +787,29 @@ class App {
if (!is_object($this)) if (!is_object($this))
return(self::$a->get_baseurl($ssl)); 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((x($this->config,'system')) && (x($this->config['system'],'ssl_policy'))) {
if(intval($this->config['system']['ssl_policy']) === intval(SSL_POLICY_FULL)) 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.
if($this->config['system']['ssl_policy'] == SSL_POLICY_SELFSIGN) {
if($ssl)
$scheme = 'https'; $scheme = 'https';
else
$scheme = 'http'; // 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 (get_config('config','hostname') != "")
$this->hostname = get_config('config','hostname');
$this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
} }
if (get_config('config','hostname') != "")
$this->hostname = get_config('config','hostname');
$this->baseurl = $scheme . "://" . $this->hostname . ((isset($this->path) && strlen($this->path)) ? '/' . $this->path : '' );
return $this->baseurl; return $this->baseurl;
} }