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:
authormattab <matthieu.aubry@gmail.com>2013-04-05 08:03:53 +0400
committermattab <matthieu.aubry@gmail.com>2013-04-05 08:03:53 +0400
commit5001bdda1f78c27a5040be3da5b596ee2ba90238 (patch)
tree3d602ae06ffa9cd94d8a050b7b36cdcba371d44b /plugins/MultiSites
parentd88521348b5c679a767c322d7edb9e24f929e5c4 (diff)
fixes #3636
Now returning zero result when no site matches the pattern Sorry for the delay Thomas!
Diffstat (limited to 'plugins/MultiSites')
-rwxr-xr-xplugins/MultiSites/API.php30
1 files changed, 18 insertions, 12 deletions
diff --git a/plugins/MultiSites/API.php b/plugins/MultiSites/API.php
index 72de40f5e8..b6b0a4d1ae 100755
--- a/plugins/MultiSites/API.php
+++ b/plugins/MultiSites/API.php
@@ -98,6 +98,9 @@ class Piwik_MultiSites_API
$idSites = $this->getSitesIdFromPattern($pattern);
+ if(empty($idSites)) {
+ return new Piwik_DataTable();
+ }
return $this->buildDataTable(
$idSites,
$period,
@@ -118,17 +121,18 @@ class Piwik_MultiSites_API
private function getSitesIdFromPattern($pattern)
{
$idSites = 'all';
- if (!empty($pattern)) {
- $sites = Piwik_API_Request::processRequest('SitesManager.getPatternMatchSites',
- array('pattern' => $pattern,
- // added because caller could overwrite these
- 'serialize' => 0,
- 'format' => 'original'));
- if (!empty($sites)) {
- $idSites = array();
- foreach ($sites as $site) {
- $idSites[] = $site['idsite'];
- }
+ if(empty($pattern)) {
+ return $idSites;
+ }
+ $idSites = array();
+ $sites = Piwik_API_Request::processRequest('SitesManager.getPatternMatchSites',
+ array('pattern' => $pattern,
+ // added because caller could overwrite these
+ 'serialize' => 0,
+ 'format' => 'original'));
+ if (!empty($sites)) {
+ foreach ($sites as $site) {
+ $idSites[] = $site['idsite'];
}
}
return $idSites;
@@ -280,7 +284,8 @@ class Piwik_MultiSites_API
$dataTable->filter('Sort', array(self::NB_VISITS_METRIC, 'desc', $naturalSort = false));
// filter rows without visits
- // note: if only one website is queried and there are no visits, we can not remove the row otherwise Piwik_API_ResponseBuilder throws 'Call to a member function getColumns() on a non-object'
+ // note: if only one website is queried and there are no visits, we can not remove the row otherwise
+ // Piwik_API_ResponseBuilder throws 'Call to a member function getColumns() on a non-object'
if ($multipleWebsitesRequested
// We don't delete the 0 visits row, if "Enhanced" mode is on.
&& !$enhanced) {
@@ -460,3 +465,4 @@ class Piwik_MultiSites_API
return 'last_period_' . $name;
}
}
+