diff options
author | Stefan Giehl <stefan@matomo.org> | 2022-07-25 11:52:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-25 11:52:26 +0300 |
commit | 064f6db3b8f8534e9aaaf881168017bac5fcb6cf (patch) | |
tree | 2a5d65ace231e95a40fef942201d818327807881 /core | |
parent | 914d48f4f6817175404f27414eaf1158c7123ac7 (diff) |
Fix possible notices / code improvements (#19561)
* Improve reading possibly undefined config value
* Improve reading possibly undefined config value
* remove another error suppression
Diffstat (limited to 'core')
-rw-r--r-- | core/Plugin/Report.php | 2 | ||||
-rw-r--r-- | core/SettingsPiwik.php | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/core/Plugin/Report.php b/core/Plugin/Report.php index bf77e75f62..2fb4f14f18 100644 --- a/core/Plugin/Report.php +++ b/core/Plugin/Report.php @@ -921,7 +921,7 @@ class Report $translation = $metric->getTranslatedName(); } else { $metricName = $metric; - $translation = @$translations[$metric]; + $translation = $translations[$metric] ?? null; } $metrics[$metricName] = $translation ?: $metricName; diff --git a/core/SettingsPiwik.php b/core/SettingsPiwik.php index a78f0a84c5..9edbec35cc 100644 --- a/core/SettingsPiwik.php +++ b/core/SettingsPiwik.php @@ -10,6 +10,7 @@ namespace Piwik; use Exception; use Piwik\Cache as PiwikCache; +use Piwik\Config\GeneralConfig; use Piwik\Container\StaticContainer; /** @@ -467,9 +468,8 @@ class SettingsPiwik */ public static function getPiwikInstanceId() { - // until Piwik is installed, we use hostname as instance_id - if (!self::isMatomoInstalled() - && Common::isPhpCliMode()) { + // until Matomo is installed, we use hostname as instance_id + if (!self::isMatomoInstalled() && Common::isPhpCliMode()) { // enterprise:install use case return Config::getHostname(); } @@ -479,12 +479,12 @@ class SettingsPiwik return false; } - $instanceId = @Config::getInstance()->General['instance_id']; + $instanceId = GeneralConfig::getConfigValue('instance_id'); if (!empty($instanceId)) { return $instanceId; } - // do not rewrite the path as Piwik uses the standard config.ini.php file + // do not rewrite the path as Matomo uses the standard config.ini.php file return false; } |