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:
authorStefan Giehl <stefan@matomo.org>2019-09-05 23:11:24 +0300
committerThomas Steur <tsteur@users.noreply.github.com>2019-09-05 23:11:24 +0300
commitff3985147a2dffaebaf4347f4d00f4c070ff4a09 (patch)
treef25786c7195f045897a7886254fab24634d912b8
parentf598c3be64b31fde21731bc7292e14bff6aa8118 (diff)
Make it possible to force archiving for custom date ranges (#14856)
-rwxr-xr-xconfig/global.ini.php5
-rw-r--r--core/CronArchive.php10
-rw-r--r--tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png4
3 files changed, 16 insertions, 3 deletions
diff --git a/config/global.ini.php b/config/global.ini.php
index 663e19f317..74e3e306a9 100755
--- a/config/global.ini.php
+++ b/config/global.ini.php
@@ -362,6 +362,11 @@ enable_browser_archiving_triggering = 1
; or make sure the date ranges users' want to see will be processed somehow.
archiving_range_force_on_browser_request = 1
+; By default Matomo will automatically archive all date ranges any user has chosen in his account settings.
+; This is limited to the available options last7, previous7, last30 and previous30.
+; If you need any other period, or want to ensure one of those is always archived, you can define them here
+archiving_custom_ranges[] =
+
; By default Matomo runs OPTIMIZE TABLE SQL queries to free spaces after deleting some data.
; If your Matomo tracks millions of pages, the OPTIMIZE TABLE queries might run for hours (seen in "SHOW FULL PROCESSLIST \g")
; so you can disable these special queries here:
diff --git a/core/CronArchive.php b/core/CronArchive.php
index 3f3d645d98..b4bc702d46 100644
--- a/core/CronArchive.php
+++ b/core/CronArchive.php
@@ -1685,9 +1685,17 @@ class CronArchive
if (is_null($cache)) {
$cache = $this->loadCustomDateRangeToPreProcess();
}
+
if (empty($cache[$idSite])) {
- return array();
+ $cache[$idSite] = array();
+ }
+
+ $customRanges = array_filter(Config::getInstance()->General['archiving_custom_ranges']);
+
+ if (!empty($customRanges)) {
+ $cache[$idSite] = array_merge($cache[$idSite], $customRanges);
}
+
$dates = array_unique($cache[$idSite]);
return $dates;
}
diff --git a/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png b/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png
index 523ca82f0f..5b077378e8 100644
--- a/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png
+++ b/tests/UI/expected-screenshots/UIIntegrationTest_admin_diagnostics_configfile.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:a52ada389805b8481a1ac02457c458784295c763dcd18f9d1341a496922a1483
-size 4305563
+oid sha256:51c4781efd832067a5919d6e103abb1bc96ae478df8c5a1ca155357832aa6494
+size 4329802