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:
authorThomas Steur <tsteur@users.noreply.github.com>2019-09-19 02:19:56 +0300
committerGitHub <noreply@github.com>2019-09-19 02:19:56 +0300
commit3b60da8343e79a490e7459a4aab580f17a5c6ca4 (patch)
tree6a98681327b541f80b7a955895724a34aa7f93aa /plugins/CoreAdminHome
parentf697570e06d16c79e4b32ed4733b48f63f2173f6 (diff)
Fix failing updater screenshot test (#14898)
Diffstat (limited to 'plugins/CoreAdminHome')
-rw-r--r--plugins/CoreAdminHome/CustomLogo.php24
1 files changed, 20 insertions, 4 deletions
diff --git a/plugins/CoreAdminHome/CustomLogo.php b/plugins/CoreAdminHome/CustomLogo.php
index 1c1368a1f5..9c2606cd20 100644
--- a/plugins/CoreAdminHome/CustomLogo.php
+++ b/plugins/CoreAdminHome/CustomLogo.php
@@ -8,6 +8,7 @@
*/
namespace Piwik\Plugins\CoreAdminHome;
+use DI\NotFoundException;
use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Filesystem;
@@ -135,24 +136,39 @@ class CustomLogo
return Filesystem::getPathToPiwikRoot() . '/' . $logo;
}
+ private static function getBasePath()
+ {
+ try {
+ $basePath = StaticContainer::get('path.misc.user');
+ return $basePath;
+ } catch (NotFoundException $e) {
+ // happens when upgrading from an older version which didn't have that global config entry yet
+ // to a newer version of Matomo when this value is being requested while the update happens
+ // basically request starts... the old global.php is loaded, then we update all PHP files, then after the
+ // update within the same request a newer version of CustomLogo.php is loaded and they are not compatible.
+ // In this case we return the default value
+ return 'misc/user/';
+ }
+ }
+
public static function getPathUserLogo()
{
- return static::rewritePath(StaticContainer::get('path.misc.user') . 'logo.png');
+ return static::rewritePath(self::getBasePath() . 'logo.png');
}
public static function getPathUserFavicon()
{
- return static::rewritePath(StaticContainer::get('path.misc.user') . 'favicon.png');
+ return static::rewritePath(self::getBasePath() . 'favicon.png');
}
public static function getPathUserSvgLogo()
{
- return static::rewritePath(StaticContainer::get('path.misc.user') . 'logo.svg');
+ return static::rewritePath(self::getBasePath() . 'logo.svg');
}
public static function getPathUserLogoSmall()
{
- return static::rewritePath(StaticContainer::get('path.misc.user') . 'logo-header.png');
+ return static::rewritePath(self::getBasePath() . 'logo-header.png');
}
protected static function rewritePath($path)