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>2016-12-11 23:41:58 +0300
committerGitHub <noreply@github.com>2016-12-11 23:41:58 +0300
commitdf62e6ff27f9b2f92186965ccc548e6db5955c36 (patch)
tree2a5b3127e2bda6741ed7a7955187e8db0a5c13b4
parent9227a3a695aa8db3291e3fd994c9a7733ee643bf (diff)
Make sure to trigger Sites.getSites event when a new Site instance is created
Background: In Piwik 2.13 we removed the `Site.setSite` event because it is slow. So in some cases it may not actually trigger a `Sites.setSites` event when a site is loaded. For example when doing `new Site()`. I think in this case we should still trigger that event if the site did not exist yet because we do not call it very often and not in a loop for all sites etc. This is useful since `new Site` is used eg in `Controller` and for such cases we should trigger this event.
-rw-r--r--core/Site.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/core/Site.php b/core/Site.php
index a45a4a5e2e..97381cab04 100644
--- a/core/Site.php
+++ b/core/Site.php
@@ -65,6 +65,8 @@ class Site
$this->id = (int)$idsite;
if (!isset(self::$infoSites[$this->id])) {
$site = API::getInstance()->getSiteFromId($this->id);
+ $sites = array(&$site);
+ self::triggerSetSitesEvent($sites);
self::setSiteFromArray($this->id, $site);
}
}