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:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CoreAdminHome/Tasks.php18
-rw-r--r--plugins/CoreAdminHome/templates/optOut.twig9
-rw-r--r--plugins/CoreAdminHome/tests/Integration/TasksTest.php1
-rw-r--r--plugins/CoreHome/CoreHome.php6
m---------plugins/CustomDimensions0
-rw-r--r--plugins/Dashboard/Dashboard.php6
-rw-r--r--plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_create_new.png4
-rw-r--r--plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_reset.png4
m---------plugins/DeviceDetectorCache0
-rw-r--r--plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php9
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml2
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml24
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml12
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml2
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml50
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml16
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml4
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml26
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml16
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml2
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml24
-rw-r--r--plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml12
-rw-r--r--plugins/Goals/Controller.php9
-rw-r--r--plugins/Installation/ServerFilesGenerator.php8
-rw-r--r--plugins/Live/Model.php89
-rw-r--r--plugins/Live/tests/Integration/ModelTest.php11
-rw-r--r--plugins/Marketplace/lang/en.json1
-rw-r--r--plugins/Marketplace/templates/getPremiumFeatures.twig3
-rw-r--r--plugins/Monolog/Processor/ExceptionToTextProcessor.php4
-rw-r--r--plugins/PrivacyManager/tests/Integration/DataPurgingTest.php7
-rw-r--r--plugins/PrivacyManager/tests/Integration/Model/DataSubjectsTest.php8
-rw-r--r--plugins/Proxy/Controller.php7
-rw-r--r--plugins/SitesManager/tests/Integration/SitesManagerTest.php12
-rw-r--r--plugins/Transitions/API.php58
-rw-r--r--plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php1
35 files changed, 254 insertions, 211 deletions
diff --git a/plugins/CoreAdminHome/Tasks.php b/plugins/CoreAdminHome/Tasks.php
index d94979c9c3..1e3933f972 100644
--- a/plugins/CoreAdminHome/Tasks.php
+++ b/plugins/CoreAdminHome/Tasks.php
@@ -9,11 +9,14 @@
namespace Piwik\Plugins\CoreAdminHome;
use Piwik\API\Request;
+use Piwik\Archive;
+use Piwik\Archive\ArchiveInvalidator;
use Piwik\ArchiveProcessor\Rules;
use Piwik\Archive\ArchivePurger;
use Piwik\Common;
use Piwik\Config;
use Piwik\Container\StaticContainer;
+use Piwik\CronArchive;
use Piwik\DataAccess\ArchiveTableCreator;
use Piwik\Date;
use Piwik\Db;
@@ -60,6 +63,10 @@ class Tasks extends \Piwik\Plugin\Tasks
public function schedule()
{
+ // for browser triggered archiving, make sure we invalidate archives once a day just to make
+ // sure all archives that need to be invalidated get invalidated
+ $this->daily('invalidateOutdatedArchives', null, self::HIGH_PRIORITY);
+
// general data purge on older archive tables, executed daily
$this->daily('purgeOutdatedArchives', null, self::HIGH_PRIORITY);
@@ -81,6 +88,17 @@ class Tasks extends \Piwik\Plugin\Tasks
$this->scheduleTrackingCodeReminderChecks();
}
+ public function invalidateOutdatedArchives()
+ {
+ if (!Rules::isBrowserTriggerEnabled()) {
+ $this->logger->info("Browser triggered archiving disabled, archives will be invalidated during core:archive.");
+ return;
+ }
+
+ $cronArchive = new CronArchive();
+ $cronArchive->invalidateArchivedReportsForSitesThatNeedToBeArchivedAgain();
+ }
+
private function scheduleTrackingCodeReminderChecks()
{
$daysToTrackedVisitsCheck = (int) Config::getInstance()->General['num_days_before_tracking_code_reminder'];
diff --git a/plugins/CoreAdminHome/templates/optOut.twig b/plugins/CoreAdminHome/templates/optOut.twig
index e97389b281..957a2c72cd 100644
--- a/plugins/CoreAdminHome/templates/optOut.twig
+++ b/plugins/CoreAdminHome/templates/optOut.twig
@@ -33,7 +33,14 @@
#}
{% if showConfirmOnly %}
<p>{{ 'CoreAdminHome_OptingYouOut'|translate }}</p>
- <script>window.close();</script>
+ <script>
+ {# try to update nonce in iframe, so sending it a second time works #}
+ try {
+ window.opener.document.querySelector('[name="nonce"]').value = '{{ nonce }}';
+ window.opener.document.querySelector('form').action = window.opener.document.querySelector('form').action.replace(/nonce=[0-9a-z]+/, 'nonce={{ nonce }}');
+ } catch (e) {}
+ window.close();
+ </script>
<noscript>
{% endif %}
diff --git a/plugins/CoreAdminHome/tests/Integration/TasksTest.php b/plugins/CoreAdminHome/tests/Integration/TasksTest.php
index 431ab833f9..7449222454 100644
--- a/plugins/CoreAdminHome/tests/Integration/TasksTest.php
+++ b/plugins/CoreAdminHome/tests/Integration/TasksTest.php
@@ -132,6 +132,7 @@ class TasksTest extends IntegrationTestCase
$tasks = array_map(function (Task $task) { return $task->getMethodName() . '.' . $task->getMethodParameter(); }, $tasks);
$expected = [
+ 'invalidateOutdatedArchives.',
'purgeOutdatedArchives.',
'purgeInvalidatedArchives.',
'purgeOrphanedArchives.',
diff --git a/plugins/CoreHome/CoreHome.php b/plugins/CoreHome/CoreHome.php
index 6587e5ad13..84d5fc66a0 100644
--- a/plugins/CoreHome/CoreHome.php
+++ b/plugins/CoreHome/CoreHome.php
@@ -11,13 +11,16 @@ namespace Piwik\Plugins\CoreHome;
use Piwik\Archive\ArchiveInvalidator;
use Piwik\Columns\ComputedMetricFactory;
use Piwik\Columns\MetricsList;
+use Piwik\Common;
use Piwik\Container\StaticContainer;
+use Piwik\DbHelper;
use Piwik\IP;
use Piwik\Piwik;
use Piwik\Plugin\ArchivedMetric;
use Piwik\Plugin\ComputedMetric;
use Piwik\Plugin\ThemeStyles;
use Piwik\SettingsServer;
+use Piwik\Tracker\Model as TrackerModel;
/**
*
@@ -59,6 +62,9 @@ class CoreHome extends \Piwik\Plugin
/** @var ArchiveInvalidator $archiveInvalidator */
$archiveInvalidator = StaticContainer::get(ArchiveInvalidator::class);
$cacheGeneral[ArchiveInvalidator::TRACKER_CACHE_KEY] = $archiveInvalidator->getAllRememberToInvalidateArchivedReportsLater();
+
+ $hasIndex = DbHelper::tableHasIndex(Common::prefixTable('log_visit'), 'index_idsite_idvisitor');
+ $cacheGeneral[TrackerModel::CACHE_KEY_INDEX_IDSITE_IDVISITOR] = $hasIndex;
}
public function addStylesheets(&$mergedContent)
diff --git a/plugins/CustomDimensions b/plugins/CustomDimensions
-Subproject e0b449f67d8ccbf43ea25caa350a4dbe57c2389
+Subproject bdc988a16f5b604a3f882c366585467eb1bd54e
diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php
index 069e6cb969..9a5e381513 100644
--- a/plugins/Dashboard/Dashboard.php
+++ b/plugins/Dashboard/Dashboard.php
@@ -157,11 +157,7 @@ class Dashboard extends \Piwik\Plugin
if ($advertising->areAdsForProfessionalServicesEnabled() && $pluginManager->isPluginActivated('ProfessionalServices')) {
$advertisingWidget = '{"uniqueId":"widgetProfessionalServicespromoServices","parameters":{"module":"ProfessionalServices","action":"promoServices"}},';
}
- if (Piwik::hasUserSuperUserAccess()) {
- $piwikPromoWidget = '{"uniqueId":"widgetCoreHomegetDonateForm","parameters":{"module":"CoreHome","action":"getDonateForm"}}';
- } else {
- $piwikPromoWidget = '{"uniqueId":"widgetCoreHomegetPromoVideo","parameters":{"module":"CoreHome","action":"getPromoVideo"}}';
- }
+ $piwikPromoWidget = '{"uniqueId":"widgetCoreHomegetPromoVideo","parameters":{"module":"CoreHome","action":"getPromoVideo"}}';
$insightsWidget = '';
if ($pluginManager->isPluginActivated('Insights')) {
$insightsWidget = '{"uniqueId":"widgetInsightsgetOverallMoversAndShakers","parameters":{"module":"Insights","action":"getOverallMoversAndShakers"}},';
diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_create_new.png b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_create_new.png
index 476dd842f2..e7e03cfe7b 100644
--- a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_create_new.png
+++ b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_create_new.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:3fb778b95d00d90336df9679e96014f513ff058df9f76ea502d023a757bf1285
-size 305893
+oid sha256:ceba2add6b8d6537ed128ad8930a48e10fdf701551bf6d51f98aaa60d91fd705
+size 317218
diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_reset.png b/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_reset.png
index dffc459de3..5e1d8961c9 100644
--- a/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_reset.png
+++ b/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_reset.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:6718ef832b90b5fc4334fdd9f71769931495b0bdcac16a97a726e6cccf64052d
-size 350683
+oid sha256:c826017ba202846f96d3b6c995d8d3c525d635975afec436baff38da7a8488e3
+size 378817
diff --git a/plugins/DeviceDetectorCache b/plugins/DeviceDetectorCache
-Subproject a50e94149170ef73928184ba3f58ef2d8d1adb4
+Subproject a34a70f5d7db59745c5f64e07957846148b7a2f
diff --git a/plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php b/plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php
index 22ea04120e..f5e0f742ef 100644
--- a/plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php
+++ b/plugins/ExampleLogTables/tests/Fixtures/VisitsWithUserIdAndCustomData.php
@@ -44,9 +44,10 @@ class VisitsWithUserIdAndCustomData extends Fixture
foreach (array('user1', 'user2', 'user3', 'user4', false) as $key => $userId) {
for ($numVisits = 0; $numVisits < ($key+1) * 10; $numVisits++) {
+ $visitDateTime = Date::factory($this->dateTime)->addHour($numVisits)->getDatetime();
+ $t->setForceVisitDateTime($visitDateTime);
$t->setUserId($userId);
- $t->setPlugins($numVisits % 3 == 0, $numVisits % 5 == 0, $numVisits % 7 == 0);
- $t->setBrowserHasCookies($numVisits % 3 == 0);
+ $t->setVisitorId(str_pad($numVisits.$key, 16, 'a'));
$t->setCountry(self::$countryCodes[$numVisits % count(self::$countryCodes)]);
if ($numVisits % 5 == 0) {
@@ -72,7 +73,7 @@ class VisitsWithUserIdAndCustomData extends Fixture
$t->setForceNewVisit();
$t->setUrl('http://example.org/my/dir/page' . ($numVisits % 4));
- $visitDateTime = Date::factory($this->dateTime)->addHour($numVisits*6)->getDatetime();
+ $visitDateTime = Date::factory($this->dateTime)->addHour($numVisits+6)->getDatetime();
$t->setForceVisitDateTime($visitDateTime);
if ($numVisits % 7 == 0) {
@@ -82,7 +83,7 @@ class VisitsWithUserIdAndCustomData extends Fixture
self::assertTrue($t->doTrackPageView('incredible title ' . ($numVisits % 3)));
if ($numVisits % 9 == 0) {
- $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour($numVisits*6.1)->getDatetime());
+ $t->setForceVisitDateTime(Date::factory($this->dateTime)->addHour($numVisits+6.1)->getDatetime());
$t->addEcommerceItem('SKU VERY nice indeed ' . ($numVisits%3), 'PRODUCT name ' . ($numVisits%4), 'category ' . ($numVisits%5), $numVisits*2.79);
self::assertTrue($t->doTrackEcommerceCartUpdate($numVisits*17));
}
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml
index d73153a828..61570f95fd 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__Actions.get_month.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
<nb_pageviews>45</nb_pageviews>
- <nb_uniq_pageviews>40</nb_uniq_pageviews>
+ <nb_uniq_pageviews>45</nb_uniq_pageviews>
<nb_downloads>7</nb_downloads>
<nb_uniq_downloads>7</nb_uniq_downloads>
<nb_outlinks>0</nb_outlinks>
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml
index e9d5ed7b27..66ddc67d77 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__UserId.getUsers_month.xml
@@ -2,26 +2,26 @@
<result>
<row>
<label>user3</label>
- <nb_visits>34</nb_visits>
+ <nb_visits>33</nb_visits>
<nb_actions>53</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>20</sum_visit_length>
- <bounce_count>19</bounce_count>
+ <max_actions>4</max_actions>
+ <sum_visit_length>741</sum_visit_length>
+ <bounce_count>16</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>8</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>8</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>30</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
</row>
<row>
<label>user1</label>
- <nb_visits>12</nb_visits>
+ <nb_visits>13</nb_visits>
<nb_actions>18</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>6</sum_visit_length>
- <bounce_count>7</bounce_count>
+ <max_actions>2</max_actions>
+ <sum_visit_length>727</sum_visit_length>
+ <bounce_count>8</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>3</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>10</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
</row>
</result> \ No newline at end of file
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml
index ff76df488f..94efd54469 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_admin__VisitsSummary.get_month.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
- <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_uniq_visitors>40</nb_uniq_visitors>
<nb_users>2</nb_users>
<nb_visits>46</nb_visits>
<nb_actions>71</nb_actions>
<nb_visits_converted>0</nb_visits_converted>
- <bounce_count>26</bounce_count>
- <sum_visit_length>26</sum_visit_length>
- <max_actions>3</max_actions>
- <bounce_rate>57%</bounce_rate>
+ <bounce_count>24</bounce_count>
+ <sum_visit_length>1468</sum_visit_length>
+ <max_actions>4</max_actions>
+ <bounce_rate>52%</bounce_rate>
<nb_actions_per_visit>1.5</nb_actions_per_visit>
- <avg_time_on_site>1</avg_time_on_site>
+ <avg_time_on_site>32</avg_time_on_site>
</result> \ No newline at end of file
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml
index 189d44ca43..2d7edd1635 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__Actions.get_month.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
<nb_pageviews>171</nb_pageviews>
- <nb_uniq_pageviews>151</nb_uniq_pageviews>
+ <nb_uniq_pageviews>171</nb_uniq_pageviews>
<nb_downloads>24</nb_downloads>
<nb_uniq_downloads>24</nb_uniq_downloads>
<nb_outlinks>0</nb_outlinks>
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml
index 1e4420b714..88cc874456 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__UserId.getUsers_month.xml
@@ -2,50 +2,50 @@
<result>
<row>
<label>user4</label>
- <nb_visits>45</nb_visits>
- <nb_actions>74</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>28</sum_visit_length>
- <bounce_count>22</bounce_count>
+ <nb_visits>43</nb_visits>
+ <nb_actions>70</nb_actions>
+ <max_actions>4</max_actions>
+ <sum_visit_length>1108</sum_visit_length>
+ <bounce_count>20</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>11</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>11</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>40</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>3</sum_daily_nb_users>
</row>
<row>
<label>user3</label>
- <nb_visits>34</nb_visits>
+ <nb_visits>33</nb_visits>
<nb_actions>53</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>20</sum_visit_length>
- <bounce_count>19</bounce_count>
+ <max_actions>4</max_actions>
+ <sum_visit_length>741</sum_visit_length>
+ <bounce_count>16</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>8</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>8</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>30</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
</row>
<row>
<label>user2</label>
- <nb_visits>22</nb_visits>
+ <nb_visits>23</nb_visits>
<nb_actions>35</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>12</sum_visit_length>
- <bounce_count>12</bounce_count>
+ <max_actions>2</max_actions>
+ <sum_visit_length>735</sum_visit_length>
+ <bounce_count>11</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>6</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>6</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>20</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
</row>
<row>
<label>user1</label>
- <nb_visits>12</nb_visits>
+ <nb_visits>13</nb_visits>
<nb_actions>18</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>6</sum_visit_length>
- <bounce_count>7</bounce_count>
+ <max_actions>2</max_actions>
+ <sum_visit_length>727</sum_visit_length>
+ <bounce_count>8</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>3</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>10</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
</row>
</result> \ No newline at end of file
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml
index 66190100e5..23b293cf53 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_all__VisitsSummary.get_month.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
- <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_uniq_visitors>150</nb_uniq_visitors>
<nb_users>4</nb_users>
- <nb_visits>164</nb_visits>
+ <nb_visits>191</nb_visits>
<nb_actions>264</nb_actions>
<nb_visits_converted>0</nb_visits_converted>
- <bounce_count>86</bounce_count>
- <sum_visit_length>97</sum_visit_length>
- <max_actions>3</max_actions>
- <bounce_rate>52%</bounce_rate>
- <nb_actions_per_visit>1.6</nb_actions_per_visit>
- <avg_time_on_site>1</avg_time_on_site>
+ <bounce_count>120</bounce_count>
+ <sum_visit_length>5492</sum_visit_length>
+ <max_actions>4</max_actions>
+ <bounce_rate>63%</bounce_rate>
+ <nb_actions_per_visit>1.4</nb_actions_per_visit>
+ <avg_time_on_site>29</avg_time_on_site>
</result> \ No newline at end of file
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml
index c693c3bcc9..d6b21a8339 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__Actions.get_month.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
<nb_pageviews>57</nb_pageviews>
- <nb_uniq_pageviews>50</nb_uniq_pageviews>
+ <nb_uniq_pageviews>57</nb_uniq_pageviews>
<nb_downloads>8</nb_downloads>
<nb_uniq_downloads>8</nb_uniq_downloads>
<nb_outlinks>0</nb_outlinks>
<nb_uniq_outlinks>0</nb_uniq_outlinks>
- <nb_searches>12</nb_searches>
+ <nb_searches>10</nb_searches>
<nb_keywords>8</nb_keywords>
</result> \ No newline at end of file
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml
index 06f94bf4e8..9f798cd7bf 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__UserId.getUsers_month.xml
@@ -2,26 +2,26 @@
<result>
<row>
<label>user4</label>
- <nb_visits>45</nb_visits>
- <nb_actions>74</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>28</sum_visit_length>
- <bounce_count>22</bounce_count>
+ <nb_visits>43</nb_visits>
+ <nb_actions>70</nb_actions>
+ <max_actions>4</max_actions>
+ <sum_visit_length>1108</sum_visit_length>
+ <bounce_count>20</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>11</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>11</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>40</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>3</sum_daily_nb_users>
</row>
<row>
<label>user1</label>
- <nb_visits>12</nb_visits>
+ <nb_visits>13</nb_visits>
<nb_actions>18</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>6</sum_visit_length>
- <bounce_count>7</bounce_count>
+ <max_actions>2</max_actions>
+ <sum_visit_length>727</sum_visit_length>
+ <bounce_count>8</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>3</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>3</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>10</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
</row>
</result> \ No newline at end of file
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml
index a8c9a77cac..0dec751572 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_men__VisitsSummary.get_month.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
- <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_uniq_visitors>50</nb_uniq_visitors>
<nb_users>2</nb_users>
- <nb_visits>57</nb_visits>
- <nb_actions>92</nb_actions>
+ <nb_visits>56</nb_visits>
+ <nb_actions>88</nb_actions>
<nb_visits_converted>0</nb_visits_converted>
- <bounce_count>29</bounce_count>
- <sum_visit_length>34</sum_visit_length>
- <max_actions>3</max_actions>
- <bounce_rate>51%</bounce_rate>
+ <bounce_count>28</bounce_count>
+ <sum_visit_length>1835</sum_visit_length>
+ <max_actions>4</max_actions>
+ <bounce_rate>50%</bounce_rate>
<nb_actions_per_visit>1.6</nb_actions_per_visit>
- <avg_time_on_site>1</avg_time_on_site>
+ <avg_time_on_site>33</avg_time_on_site>
</result> \ No newline at end of file
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml
index 4269b53424..06508b8e7a 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__Actions.get_month.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
<nb_pageviews>57</nb_pageviews>
- <nb_uniq_pageviews>50</nb_uniq_pageviews>
+ <nb_uniq_pageviews>57</nb_uniq_pageviews>
<nb_downloads>8</nb_downloads>
<nb_uniq_downloads>8</nb_uniq_downloads>
<nb_outlinks>0</nb_outlinks>
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml
index d9abec4587..2fe5964a40 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__UserId.getUsers_month.xml
@@ -2,26 +2,26 @@
<result>
<row>
<label>user3</label>
- <nb_visits>34</nb_visits>
+ <nb_visits>33</nb_visits>
<nb_actions>53</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>20</sum_visit_length>
- <bounce_count>19</bounce_count>
+ <max_actions>4</max_actions>
+ <sum_visit_length>741</sum_visit_length>
+ <bounce_count>16</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>8</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>8</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>30</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
</row>
<row>
<label>user2</label>
- <nb_visits>22</nb_visits>
+ <nb_visits>23</nb_visits>
<nb_actions>35</nb_actions>
- <max_actions>3</max_actions>
- <sum_visit_length>12</sum_visit_length>
- <bounce_count>12</bounce_count>
+ <max_actions>2</max_actions>
+ <sum_visit_length>735</sum_visit_length>
+ <bounce_count>11</bounce_count>
<nb_visits_converted>0</nb_visits_converted>
- <sum_daily_nb_uniq_visitors>6</sum_daily_nb_uniq_visitors>
- <sum_daily_nb_users>6</sum_daily_nb_users>
+ <sum_daily_nb_uniq_visitors>20</sum_daily_nb_uniq_visitors>
+ <sum_daily_nb_users>2</sum_daily_nb_users>
</row>
</result> \ No newline at end of file
diff --git a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml
index 7011733c70..22d38cc245 100644
--- a/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml
+++ b/plugins/ExampleLogTables/tests/System/expected/test_ExampleLogTables_women__VisitsSummary.get_month.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<result>
- <nb_uniq_visitors>1</nb_uniq_visitors>
+ <nb_uniq_visitors>50</nb_uniq_visitors>
<nb_users>2</nb_users>
<nb_visits>56</nb_visits>
<nb_actions>88</nb_actions>
<nb_visits_converted>0</nb_visits_converted>
- <bounce_count>31</bounce_count>
- <sum_visit_length>32</sum_visit_length>
- <max_actions>3</max_actions>
- <bounce_rate>55%</bounce_rate>
+ <bounce_count>27</bounce_count>
+ <sum_visit_length>1476</sum_visit_length>
+ <max_actions>4</max_actions>
+ <bounce_rate>48%</bounce_rate>
<nb_actions_per_visit>1.6</nb_actions_per_visit>
- <avg_time_on_site>1</avg_time_on_site>
+ <avg_time_on_site>26</avg_time_on_site>
</result> \ No newline at end of file
diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php
index 9da9138fa3..3367fcaf93 100644
--- a/plugins/Goals/Controller.php
+++ b/plugins/Goals/Controller.php
@@ -24,17 +24,12 @@ use Piwik\View;
*/
class Controller extends \Piwik\Plugin\Controller
{
- const CONVERSION_RATE_PRECISION = 1;
-
/**
* Number of "Your top converting keywords/etc are" to display in the per Goal overview page
* @var int
*/
const COUNT_TOP_ROWS_TO_DISPLAY = 3;
- const ECOMMERCE_LOG_SHOW_ORDERS = 1;
- const ECOMMERCE_LOG_SHOW_ABANDONED_CARTS = 2;
-
protected $goalColumnNameToLabel = array(
'avg_order_revenue' => 'General_AverageOrderValue',
'nb_conversions' => 'Goals_ColumnConversions',
@@ -59,10 +54,6 @@ class Controller extends \Piwik\Plugin\Controller
}
}
- if (!is_numeric($conversionRate)) {
- $conversionRate = sprintf('%.' . self::CONVERSION_RATE_PRECISION . 'f%%', $conversionRate);
- }
-
return $conversionRate;
}
diff --git a/plugins/Installation/ServerFilesGenerator.php b/plugins/Installation/ServerFilesGenerator.php
index 3bc5750e22..7ed67db57a 100644
--- a/plugins/Installation/ServerFilesGenerator.php
+++ b/plugins/Installation/ServerFilesGenerator.php
@@ -167,6 +167,12 @@ Header set Cache-Control \"Cache-Control: private, no-cache, no-store\"
'/vendor',
'/plugins',
);
+
+ $additionForPlugins = '
+ <alwaysAllowedUrls>
+ <add url="/plugins/HeatmapSessionRecording/configs.php" />
+ </alwaysAllowedUrls>';
+
foreach ($directoriesToProtect as $directoryToProtect) {
@file_put_contents(PIWIK_INCLUDE_PATH . $directoryToProtect . '/web.config',
'<?xml version="1.0" encoding="UTF-8"?>
@@ -176,7 +182,7 @@ Header set Cache-Control \"Cache-Control: private, no-cache, no-store\"
<requestFiltering>
<denyUrlSequences>
<add sequence=".php" />
- </denyUrlSequences>
+ </denyUrlSequences>' . ($directoryToProtect === '/plugins' ? $additionForPlugins : '') . '
</requestFiltering>
</security>
</system.webServer>
diff --git a/plugins/Live/Model.php b/plugins/Live/Model.php
index 89c32d2b12..fe167fcf33 100644
--- a/plugins/Live/Model.php
+++ b/plugins/Live/Model.php
@@ -16,6 +16,7 @@ use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Date;
use Piwik\Db;
+use Piwik\DbHelper;
use Piwik\Period;
use Piwik\Period\Range;
use Piwik\Piwik;
@@ -121,7 +122,7 @@ class Model
try {
$visits = $readerDb->fetchAll($sql, $bind);
} catch (Exception $e) {
- $this->handleMaxExecutionTimeError($readerDb, $e, $sql, $bind, $segment, $dateStart, $dateEnd, $minTimestamp, $limit);
+ $this->handleMaxExecutionTimeError($readerDb, $e, $segment, $dateStart, $dateEnd, $minTimestamp, $limit, ['sql' => $sql, 'bind' => $bind,]);
throw $e;
}
return $visits;
@@ -130,17 +131,16 @@ class Model
/**
* @param \Piwik\Tracker\Db|\Piwik\Db\AdapterInterface|\Piwik\Db $readerDb
* @param Exception $e
- * @param $sql
- * @param array $bind
* @param $segment
* @param $dateStart
* @param $dateEnd
* @param $minTimestamp
* @param $limit
+ * @param $parameters
*
* @throws MaxExecutionTimeExceededException
*/
- public function handleMaxExecutionTimeError($readerDb, $e, $sql, $bind, $segment, $dateStart, $dateEnd, $minTimestamp, $limit)
+ public static function handleMaxExecutionTimeError($readerDb, $e, $segment, $dateStart, $dateEnd, $minTimestamp, $limit, $parameters)
{
// we also need to check for the 'maximum statement execution time exceeded' text as the query might be
// aborted at different stages and we can't really know all the possible codes at which it may be aborted etc
@@ -148,39 +148,41 @@ class Model
|| $readerDb->isErrNo($e, DbMigration::ERROR_CODE_MAX_EXECUTION_TIME_EXCEEDED_SORT_ABORTED)
|| strpos($e->getMessage(), 'maximum statement execution time exceeded') !== false;
- if ($isMaxExecutionTimeError) {
- $message = '';
+ if (false === $isMaxExecutionTimeError) {
+ return;
+ }
+
+ $message = '';
- if ($this->isLookingAtMoreThanOneDay($dateStart, $dateEnd, $minTimestamp)) {
- $message .= ' ' . Piwik::translate('Live_QueryMaxExecutionTimeExceededReasonDateRange');
- }
+ if (self::isLookingAtMoreThanOneDay($dateStart, $dateEnd, $minTimestamp)) {
+ $message .= ' ' . Piwik::translate('Live_QueryMaxExecutionTimeExceededReasonDateRange');
+ }
- if (!empty($segment)) {
- $message .= ' ' . Piwik::translate('Live_QueryMaxExecutionTimeExceededReasonSegment');
- }
+ if (!empty($segment)) {
+ $message .= ' ' . Piwik::translate('Live_QueryMaxExecutionTimeExceededReasonSegment');
+ }
- $limitThatCannotBeSelectedInUiButOnlyApi = 550;
- if ($limit > $limitThatCannotBeSelectedInUiButOnlyApi) {
- $message .= ' ' . Piwik::translate('Live_QueryMaxExecutionTimeExceededLimit');
- }
+ $limitThatCannotBeSelectedInUiButOnlyApi = 550;
+ if ($limit > $limitThatCannotBeSelectedInUiButOnlyApi) {
+ $message .= ' ' . Piwik::translate('Live_QueryMaxExecutionTimeExceededLimit');
+ }
- if (empty($message)) {
- $message .= ' ' . Piwik::translate('Live_QueryMaxExecutionTimeExceededReasonUnknown');
- }
+ if (empty($message)) {
+ $message .= ' ' . Piwik::translate('Live_QueryMaxExecutionTimeExceededReasonUnknown');
+ }
- $message = Piwik::translate('Live_QueryMaxExecutionTimeExceeded') . ' ' . $message;
+ $message = Piwik::translate('Live_QueryMaxExecutionTimeExceeded') . ' ' . $message;
- $params = array(
- 'sql' => $sql, 'bind' => $bind, 'segment' => $segment, 'limit' => $limit
- );
+ $params = array_merge($parameters, [
+ 'segment' => $segment, 'limit' => $limit
+ ]);
- /**
- * @ignore
- * @internal
- */
- Piwik::postEvent('Live.queryMaxExecutionTimeExceeded', array($params));
- throw new MaxExecutionTimeExceededException($message);
- }
+ /**
+ * @ignore
+ * @internal
+ */
+ Piwik::postEvent('Live.queryMaxExecutionTimeExceeded', array($params));
+ throw new MaxExecutionTimeExceededException($message);
}
/**
@@ -190,7 +192,7 @@ class Model
* @return bool
* @throws Exception
*/
- public function isLookingAtMoreThanOneDay($dateStart, $dateEnd, $minTimestamp)
+ public static function isLookingAtMoreThanOneDay($dateStart, $dateEnd, $minTimestamp)
{
if (!$dateStart) {
if (!$minTimestamp) {
@@ -493,35 +495,14 @@ class Model
$bind = $innerQuery['bind'];
- $maxExecutionTimeHint = $this->getMaxExecutionTimeMySQLHint();
- if ($visitorId) {
+ if (!$visitorId) {
// for now let's not apply when looking for a specific visitor
- $maxExecutionTimeHint = '';
- }
- if ($maxExecutionTimeHint) {
- $innerQuery['sql'] = trim($innerQuery['sql']);
- $pos = stripos($innerQuery['sql'], 'SELECT');
- if ($pos !== false) {
- $innerQuery['sql'] = substr_replace($innerQuery['sql'], 'SELECT ' . $maxExecutionTimeHint, $pos, strlen('SELECT'));
- }
+ $innerQuery['sql'] = DbHelper::addMaxExecutionTimeHintToQuery($innerQuery['sql'], Config::getInstance()->General['live_query_max_execution_time']);
}
return array($innerQuery['sql'], $bind);
}
- private function getMaxExecutionTimeMySQLHint()
- {
- $general = Config::getInstance()->General;
- $maxExecutionTime = $general['live_query_max_execution_time'];
- $maxExecutionTimeHint = '';
- if (is_numeric($maxExecutionTime) && $maxExecutionTime > 0) {
- $timeInMs = $maxExecutionTime * 1000;
- $timeInMs = (int) $timeInMs;
- $maxExecutionTimeHint = ' /*+ MAX_EXECUTION_TIME('.$timeInMs.') */ ';
- }
- return $maxExecutionTimeHint;
- }
-
/**
* @param $idSite
* @return Site
diff --git a/plugins/Live/tests/Integration/ModelTest.php b/plugins/Live/tests/Integration/ModelTest.php
index ea2b104732..d66872e44d 100644
--- a/plugins/Live/tests/Integration/ModelTest.php
+++ b/plugins/Live/tests/Integration/ModelTest.php
@@ -82,8 +82,7 @@ class ModelTest extends IntegrationTestCase
$dateEnd = Date::now();
$minTimestamp = 1;
$limit = 50;
- $model = new Model();
- $model->handleMaxExecutionTimeError($db, $e, $sql, $bind, $segment, $dateStart, $dateEnd, $minTimestamp, $limit);
+ Model::handleMaxExecutionTimeError($db, $e, $segment, $dateStart, $dateEnd, $minTimestamp, $limit, [$sql, $bind]);
$this->assertTrue(true);
}
@@ -101,8 +100,7 @@ class ModelTest extends IntegrationTestCase
$dateEnd = Date::now();
$minTimestamp = null;
$limit = 50;
- $model = new Model();
- $model->handleMaxExecutionTimeError($db, $e, $sql, $bind, $segment, $dateStart, $dateEnd, $minTimestamp, $limit);
+ Model::handleMaxExecutionTimeError($db, $e, $segment, $dateStart, $dateEnd, $minTimestamp, $limit, [$sql, $bind]);
}
public function test_handleMaxExecutionTimeError_whenTimeIsExceeded_manyReasonsFound()
@@ -112,15 +110,12 @@ class ModelTest extends IntegrationTestCase
$db = Db::get();
$e = new \Exception('Query execution was interrupted, maximum statement execution time exceeded');
- $sql = 'SELECT 1';
- $bind = array();
$segment = 'userId>=1';
$dateStart = Date::now()->subDay(10);
$dateEnd = Date::now();
$minTimestamp = null;
$limit = 5000;
- $model = new Model();
- $model->handleMaxExecutionTimeError($db, $e, $sql, $bind, $segment, $dateStart, $dateEnd, $minTimestamp, $limit);
+ Model::handleMaxExecutionTimeError($db, $e, $segment, $dateStart, $dateEnd, $minTimestamp, $limit, ['param' => 'value']);
}
public function test_getStandAndEndDate()
diff --git a/plugins/Marketplace/lang/en.json b/plugins/Marketplace/lang/en.json
index a84b879240..7d9cbf34aa 100644
--- a/plugins/Marketplace/lang/en.json
+++ b/plugins/Marketplace/lang/en.json
@@ -8,6 +8,7 @@
"AllowedUploadFormats": "You may upload a plugin or theme in .zip format via this page.",
"Authors": "Authors",
"Browse": "Browse",
+ "SupportMatomoThankYou": "Any purchase will help fund the future of the Matomo open-source project. Thank you for your support!",
"LatestMarketplaceUpdates": "Latest Marketplace Updates",
"BackToMarketplace": "Back to Marketplace",
"BrowseMarketplace": "Browse Marketplace",
diff --git a/plugins/Marketplace/templates/getPremiumFeatures.twig b/plugins/Marketplace/templates/getPremiumFeatures.twig
index fa0fe83744..3663ff69c0 100644
--- a/plugins/Marketplace/templates/getPremiumFeatures.twig
+++ b/plugins/Marketplace/templates/getPremiumFeatures.twig
@@ -1,5 +1,8 @@
<div class="getNewPlugins getPremiumFeatures widgetBody">
<div class="row">
+ <div class="col s12 m12">
+ <h3 style="margin-bottom: 28px;">{{ 'Marketplace_SupportMatomoThankYou'|translate }}</h3></div>
+
{% for plugin in plugins %}
<div class="col s12 m4">
diff --git a/plugins/Monolog/Processor/ExceptionToTextProcessor.php b/plugins/Monolog/Processor/ExceptionToTextProcessor.php
index ab828dc820..0089b27d94 100644
--- a/plugins/Monolog/Processor/ExceptionToTextProcessor.php
+++ b/plugins/Monolog/Processor/ExceptionToTextProcessor.php
@@ -85,6 +85,10 @@ class ExceptionToTextProcessor
public static function getWholeBacktrace(\Exception $exception, $shouldPrintBacktrace = true)
{
+ if (!$shouldPrintBacktrace) {
+ return $exception->getMessage();
+ }
+
$message = "";
$e = $exception;
diff --git a/plugins/PrivacyManager/tests/Integration/DataPurgingTest.php b/plugins/PrivacyManager/tests/Integration/DataPurgingTest.php
index 076cf9989a..9c1c95dde4 100644
--- a/plugins/PrivacyManager/tests/Integration/DataPurgingTest.php
+++ b/plugins/PrivacyManager/tests/Integration/DataPurgingTest.php
@@ -10,6 +10,7 @@ namespace Piwik\Plugins\PrivacyManager\tests\Integration;
use Piwik\Archive;
use Piwik\Common;
use Piwik\Config;
+use Piwik\Container\StaticContainer;
use Piwik\DataAccess\RawLogDao;
use Piwik\Date;
use Piwik\Db;
@@ -741,10 +742,14 @@ class DataPurgingTest extends IntegrationTestCase
$range = $rangeStart->toString('Y-m-d') . "," . $rangeEnd->toString('Y-m-d');
$rangeArchive = Archive::build(self::$idSite, 'range', $range);
- $rangeArchive->getNumeric('nb_visits', 'nb_hits');
+ $rangeArchive->getNumeric(['nb_visits']);
APIVisitorInterest::getInstance()->getNumberOfVisitsPerVisitDuration(self::$idSite, 'range', $range);
+ // remove invalidated
+ StaticContainer::get(Archive\ArchivePurger::class)->purgeInvalidatedArchivesFrom(Date::factory('2012-01-01'));
+ StaticContainer::get(Archive\ArchivePurger::class)->purgeInvalidatedArchivesFrom(Date::factory('2012-02-01'));
+
// when archiving is initiated, the archive metrics & reports for EVERY loaded plugin
// are archived. don't want this test to depend on every possible metric, so get rid of
// the unwanted archive data now.
diff --git a/plugins/PrivacyManager/tests/Integration/Model/DataSubjectsTest.php b/plugins/PrivacyManager/tests/Integration/Model/DataSubjectsTest.php
index 3cc563081f..27a8dbc52b 100644
--- a/plugins/PrivacyManager/tests/Integration/Model/DataSubjectsTest.php
+++ b/plugins/PrivacyManager/tests/Integration/Model/DataSubjectsTest.php
@@ -366,7 +366,7 @@ class DataSubjectsTest extends IntegrationTestCase
$this->removeArchiveInvalidationOptions();
$visitDate = Date::factory($this->theFixture->dateTime);
- $key = 'report_to_invalidate_' . $idSite . '_' . $visitDate->toString('Y-m-d') . '_12345';
+ $key = '4444_report_to_invalidate_' . $idSite . '_' . $visitDate->toString('Y-m-d') . '_12345';
Option::set($key, '1');
$this->assertArchivesHaveBeenInvalidated($visitDate, $idSite);
@@ -402,14 +402,14 @@ class DataSubjectsTest extends IntegrationTestCase
private function assertArchivesHaveNotBeenInvalidated(Date $visitDate, $idSite)
{
$key = 'report_to_invalidate_' . $idSite . '_' . $visitDate->toString('Y-m-d');
- $value = Option::getLike($key . '%');
+ $value = Option::getLike('%' . $key . '%');
$this->assertEmpty($value);
}
private function assertArchivesHaveBeenInvalidated(Date $visitDate, $idSite)
{
$key = 'report_to_invalidate_' . $idSite . '_' . $visitDate->toString('Y-m-d');
- $value = Option::getLike($key . '%');
+ $value = Option::getLike('%' . $key . '%');
$this->assertNotEmpty($value);
$this->assertEquals('1', array_values($value)[0]);
}
@@ -508,7 +508,7 @@ class DataSubjectsTest extends IntegrationTestCase
private function removeArchiveInvalidationOptions()
{
- Option::deleteLike('report_to_invalidate_%');
+ Option::deleteLike('%report_to_invalidate_%');
}
private function setWebsiteTimezone($idSite, $timezone)
diff --git a/plugins/Proxy/Controller.php b/plugins/Proxy/Controller.php
index 0dfa3d03e3..4ffc45cc96 100644
--- a/plugins/Proxy/Controller.php
+++ b/plugins/Proxy/Controller.php
@@ -11,6 +11,7 @@ namespace Piwik\Plugins\Proxy;
use Piwik\AssetManager;
use Piwik\AssetManager\UIAsset;
use Piwik\Common;
+use Piwik\Exception\StylesheetLessCompileException;
use Piwik\Piwik;
use Piwik\ProxyHttp;
use Piwik\Url;
@@ -33,7 +34,11 @@ class Controller extends \Piwik\Plugin\Controller
*/
public function getCss()
{
- $cssMergedFile = AssetManager::getInstance()->getMergedStylesheet();
+ try {
+ $cssMergedFile = AssetManager::getInstance()->getMergedStylesheet();
+ } catch (StylesheetLessCompileException $exception) {
+ $cssMergedFile = AssetManager::getInstance()->getMergedStylesheet();
+ }
ProxyHttp::serverStaticFile($cssMergedFile->getAbsoluteLocation(), "text/css");
}
diff --git a/plugins/SitesManager/tests/Integration/SitesManagerTest.php b/plugins/SitesManager/tests/Integration/SitesManagerTest.php
index 24be827b95..51f07cdc2f 100644
--- a/plugins/SitesManager/tests/Integration/SitesManagerTest.php
+++ b/plugins/SitesManager/tests/Integration/SitesManagerTest.php
@@ -63,12 +63,14 @@ class SitesManagerTest extends IntegrationTestCase
$archive->rememberToInvalidateArchivedReportsLater($this->siteId, Date::factory('2014-04-06'));
$archive->rememberToInvalidateArchivedReportsLater(4949, Date::factory('2014-04-05'));
- $expected = array(
- '2014-04-05' => array($this->siteId, 4949),
- '2014-04-06' => array($this->siteId)
- );
+ $remembered = $archive->getRememberedArchivedReportsThatShouldBeInvalidated();
+ $this->assertCount(2, $remembered);
- $this->assertEquals($expected, $archive->getRememberedArchivedReportsThatShouldBeInvalidated());
+ sort($remembered['2014-04-05']);
+ $this->assertSame(array($this->siteId, 4949), $remembered['2014-04-05']);
+
+ sort($remembered['2014-04-06']);
+ $this->assertSame(array($this->siteId), $remembered['2014-04-06']);
$this->manager->onSiteDeleted($this->siteId);
diff --git a/plugins/Transitions/API.php b/plugins/Transitions/API.php
index 88bca868ef..b26b0bdc39 100644
--- a/plugins/Transitions/API.php
+++ b/plugins/Transitions/API.php
@@ -12,15 +12,18 @@ namespace Piwik\Plugins\Transitions;
use Exception;
use Piwik\ArchiveProcessor;
use Piwik\Common;
+use Piwik\Config;
use Piwik\DataAccess\LogAggregator;
use Piwik\DataArray;
use Piwik\DataTable;
use Piwik\DataTable\Row;
+use Piwik\Db;
use Piwik\Metrics;
use Piwik\Period;
use Piwik\Piwik;
use Piwik\Plugins\Actions\Actions;
use Piwik\Plugins\Actions\ArchivingHelper;
+use Piwik\Plugins\Live\Model;
use Piwik\RankingQuery;
use Piwik\Segment;
use Piwik\Segment\SegmentExpression;
@@ -81,25 +84,40 @@ class API extends \Piwik\Plugin\API
'date' => Period\Factory::build($period->getLabel(), $date)->getLocalizedShortString()
);
- $partsArray = explode(',', $parts);
- if ($parts == 'all' || in_array('internalReferrers', $partsArray)) {
- $this->addInternalReferrers($logAggregator, $report, $idaction, $actionType, $limitBeforeGrouping);
- }
- if ($parts == 'all' || in_array('followingActions', $partsArray)) {
- $includeLoops = $parts != 'all' && !in_array('internalReferrers', $partsArray);
- $this->addFollowingActions($logAggregator, $report, $idaction, $actionType, $limitBeforeGrouping, $includeLoops);
- }
- if ($parts == 'all' || in_array('externalReferrers', $partsArray)) {
- $this->addExternalReferrers($logAggregator, $report, $idaction, $actionType, $limitBeforeGrouping);
- }
+ try {
+ $partsArray = explode(',', $parts);
+ if ($parts == 'all' || in_array('internalReferrers', $partsArray)) {
+ $this->addInternalReferrers($logAggregator, $report, $idaction, $actionType, $limitBeforeGrouping);
+ }
+ if ($parts == 'all' || in_array('followingActions', $partsArray)) {
+ $includeLoops = $parts != 'all' && !in_array('internalReferrers', $partsArray);
+ $this->addFollowingActions($logAggregator, $report, $idaction, $actionType, $limitBeforeGrouping, $includeLoops);
+ }
+ if ($parts == 'all' || in_array('externalReferrers', $partsArray)) {
+ $this->addExternalReferrers($logAggregator, $report, $idaction, $actionType, $limitBeforeGrouping);
+ }
- // derive the number of exits from the other metrics
- if ($parts == 'all') {
- $report['pageMetrics']['exits'] = $report['pageMetrics']['pageviews']
- - $this->getTotalTransitionsToFollowingActions()
- - $report['pageMetrics']['loops'];
+ // derive the number of exits from the other metrics
+ if ($parts == 'all') {
+ $report['pageMetrics']['exits'] = $report['pageMetrics']['pageviews']
+ - $this->getTotalTransitionsToFollowingActions()
+ - $report['pageMetrics']['loops'];
+ }
+ } catch (\Exception $e) {
+ Model::handleMaxExecutionTimeError(
+ Db::getReader(),
+ $e,
+ $segment->getString(),
+ $period->getDateStart(),
+ $period->getDateEnd(),
+ 0,
+ Config::getInstance()->General['live_query_max_execution_time'],
+ ['method' => 'Transitions.getTransitionsForAction', 'actionName' => $actionName, 'actionType' => $actionType]
+ );
+ throw $e;
}
+
// replace column names in the data tables
$reportNames = array(
'previousPages' => true,
@@ -290,7 +308,8 @@ class API extends \Piwik\Plugin\API
$metrics,
$rankingQuery,
$joinLogActionColumn,
- $secondaryOrderBy = "`name`"
+ $secondaryOrderBy = "`name`",
+ Config::getInstance()->General['live_query_max_execution_time']
);
$dataTables = $this->makeDataTablesFollowingActions($types, $data);
@@ -342,7 +361,7 @@ class API extends \Piwik\Plugin\API
$where = 'visit_entry_idaction_' . $type . ' = ' . intval($idaction);
$metrics = array(Metrics::INDEX_NB_VISITS);
- $data = $logAggregator->queryVisitsByDimension($dimensions, $where, $selects, $metrics, $rankingQuery);
+ $data = $logAggregator->queryVisitsByDimension($dimensions, $where, $selects, $metrics, $rankingQuery, false, Config::getInstance()->General['live_query_max_execution_time']);
$referrerData = array();
$referrerSubData = array();
@@ -433,7 +452,8 @@ class API extends \Piwik\Plugin\API
$metrics,
$rankingQuery,
$joinLogActionOn,
- $secondaryOrderBy = "`name`"
+ $secondaryOrderBy = "`name`",
+ Config::getInstance()->General['live_query_max_execution_time']
);
$loops = 0;
diff --git a/plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php b/plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php
index cb390f27cf..9d463d5adb 100644
--- a/plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php
+++ b/plugins/UserId/tests/Fixtures/TrackFewVisitsAndCreateUsers.php
@@ -37,6 +37,7 @@ class TrackFewVisitsAndCreateUsers extends Fixture
foreach (array('user1', 'user2', 'user3') as $key => $userId) {
for ($numVisits = 0; $numVisits < ($key+1) * 10; $numVisits++) {
$t->setUserId($userId);
+ $t->setVisitorId(str_pad($numVisits.$key, 16, 'a'));
if ($numVisits % 5 == 0) {
$t->doTrackSiteSearch('some search term');
}