diff options
author | sgiehl <stefan@matomo.org> | 2022-06-21 10:41:56 +0300 |
---|---|---|
committer | sgiehl <stefan@matomo.org> | 2022-06-21 10:41:56 +0300 |
commit | 6a6dce9c9c36e35a6822b7c4e05def5b84f00d07 (patch) | |
tree | 754da59e4a2ed7d5feb9260195f1466fbbc93811 /core | |
parent | 3fbdf872e3d52e6d781bd6891f73ae43a988f8cc (diff) | |
parent | a6b8786a35b83e1967dd0bb92ff6f1e1acb47907 (diff) |
Merge branch 'next_release' into 4.x-dev
Diffstat (limited to 'core')
-rw-r--r-- | core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php b/core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php index 9ac1edaec7..bfd73ca039 100644 --- a/core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php +++ b/core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php @@ -276,7 +276,22 @@ class PluginUmdAssetFetcher extends UIAssetFetcher private static function getRelativePluginDirectory($plugin) { $result = self::getPluginDirectory($plugin); - $result = str_replace(PIWIK_INCLUDE_PATH . '/', '', $result); + + $matomoPath = rtrim(PIWIK_INCLUDE_PATH, '/') . '/'; + $webroots = array_merge( + Manager::getAlternativeWebRootDirectories(), + [$matomoPath => '/'] + ); + + foreach ($webroots as $webrootAbsolute => $webrootRelative) { + if (strpos($result, $webrootAbsolute) === 0) { + $result = str_replace($webrootAbsolute, $webrootRelative, $result); + break; + } + } + + $result = ltrim($result, '/'); + return $result; } |