Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZoltan Flamis <zoltan@innocraft.com>2021-06-11 12:03:43 +0300
committerGitHub <noreply@github.com>2021-06-11 12:03:43 +0300
commit4bf0ab925dc2bef87cf8070bc422ba2874fab357 (patch)
tree8c8f26d5bdc2f34fd7e5e2435ec7625318da95ad /core/Config.php
parent5e9df520fa3f7db72eafaa2f7cd112c8a58738f4 (diff)
Check if config loaded in getHostname() (#17526)
* check if config loaded * simple check if config was initialized * add parameter * check if host valid for console command
Diffstat (limited to 'core/Config.php')
-rw-r--r--core/Config.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/Config.php b/core/Config.php
index d56bdeac5d..f1230fd223 100644
--- a/core/Config.php
+++ b/core/Config.php
@@ -139,7 +139,7 @@ class Config
if (!empty($GLOBALS['CONFIG_INI_PATH_RESOLVER']) && is_callable($GLOBALS['CONFIG_INI_PATH_RESOLVER'])) {
return call_user_func($GLOBALS['CONFIG_INI_PATH_RESOLVER']);
}
-
+
$path = self::getByDomainConfigPath();
if ($path) {
return $path;
@@ -220,13 +220,14 @@ class Config
/**
* Returns the hostname of the current request (without port number)
+ * @param bool $checkIfTrusted Check trusted requires config which is maybe not ready yet,
+ * make sure the config is ready when you call with true
*
* @return string
*/
- public static function getHostname()
+ public static function getHostname($checkIfTrusted = false)
{
- // Check trusted requires config file which is not ready yet
- $host = Url::getHost($checkIfTrusted = false);
+ $host = Url::getHost($checkIfTrusted);
// Remove any port number to get actual hostname
$host = Url::getHostSanitized($host);
@@ -309,7 +310,7 @@ class Config
public function deleteLocalConfig()
{
$configLocal = $this->getLocalPath();
-
+
if(file_exists($configLocal)){
@unlink($configLocal);
}
@@ -345,7 +346,7 @@ class Config
{
return $this->settings->getIniFileChain()->getFrom($this->getCommonPath(), $name);
}
-
+
/**
* @api
*/