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
path: root/core
diff options
context:
space:
mode:
authordizzy <diosmosis@users.noreply.github.com>2022-06-21 10:40:55 +0300
committerGitHub <noreply@github.com>2022-06-21 10:40:55 +0300
commita6b8786a35b83e1967dd0bb92ff6f1e1acb47907 (patch)
treeda70519f5a0f87120aa057b63e83204f492f3acb /core
parentd22f787ff61b3547c948c76bdfbe5a478a3a5185 (diff)
[Vue] when getting plugin path relative to webroot, try all possible webroots (#19362)
* when getting plugin path relative to webroot, try all possible webroots * use key values of array * replace absolute path w/ path relative to matomo root to get it to work * fix test * remove leading slashes
Diffstat (limited to 'core')
-rw-r--r--core/AssetManager/UIAssetFetcher/PluginUmdAssetFetcher.php17
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;
}