diff options
author | Benaka <diosmosis@users.noreply.github.com> | 2018-03-06 04:10:33 +0300 |
---|---|---|
committer | Thomas Steur <tsteur@users.noreply.github.com> | 2018-03-06 04:10:33 +0300 |
commit | ee8548276846e4594933e6ba861e861b807ebd38 (patch) | |
tree | 27f552c0a3dcdc4a0412a5affb463128664e18f3 /plugins/SitesManager/SitesManager.php | |
parent | 2e94e0dbbbc833f1e0ce1fae9c509472db145b8c (diff) |
Assorted events and changes (#12496)
* Throw exception if date is empty in Period\Factory::build() since it can occur during development.
* Add API.Request.intercept event in API\Proxy so plugins can preempt normal API execution.
* Use Request::getRenamedModuleAndAction() in Visualization, as it is called in every other use of core/API/Proxy.
* Add new SitesManager.shouldPerformEmptySiteCheck event.
* Add event Request.shouldDisablePostProcessing so plugins can disable datatable post processing for certain requests.
* Make sure DataTable metadata is serialized with the table.
* Add description of API.Request.intercept, Request.shouldDisablePostProcessing, SitesManager.shouldPerformEmptySiteCheck to changelog.
Diffstat (limited to 'plugins/SitesManager/SitesManager.php')
-rw-r--r-- | plugins/SitesManager/SitesManager.php | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/plugins/SitesManager/SitesManager.php b/plugins/SitesManager/SitesManager.php index c55d581e2c..f022a96c6e 100644 --- a/plugins/SitesManager/SitesManager.php +++ b/plugins/SitesManager/SitesManager.php @@ -68,8 +68,23 @@ class SitesManager extends \Piwik\Plugin return; } + $shouldPerformEmptySiteCheck = true; + + /** + * Posted before checking to display the "No data has been recorded yet" message. + * If your Measurable should never have visits, you can use this event to make + * sure that message is never displayed. + * + * @param bool &$shouldPerformEmptySiteCheck Set this value to true to perform the + * check, false if otherwise. + * @param int $siteId The ID of the site we would perform a check for. + */ + Piwik::postEvent('SitesManager.shouldPerformEmptySiteCheck', [&$shouldPerformEmptySiteCheck, $siteId]); + $trackerModel = new TrackerModel(); - if ($trackerModel->isSiteEmpty($siteId)) { + if ($shouldPerformEmptySiteCheck + && $trackerModel->isSiteEmpty($siteId) + ) { $session = new SessionNamespace('siteWithoutData'); if (!empty($session->ignoreMessage)) { return; |