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:
authordiosmosis <diosmosis@users.noreply.github.com>2020-11-04 10:19:48 +0300
committerGitHub <noreply@github.com>2020-11-04 10:19:48 +0300
commit375dd9f6933dcf7eeb37df9d2d9f44d16f35a277 (patch)
tree135baa9b8f9f2b2758ab9adf899d4026b8a91218 /plugins
parent6b12f37eb630d25dffa13e315b894abda80ed5af (diff)
several changes to emphasize setup and use of auto-archiving rather than real-time processing (#16603)
* several changes to emphasize setup and use of auto-archiving rather than real-time processing * apply some pr feedback * Applying more pr feedback. * apply review fixes * ignore ability to archive segments in real time * another tweak * update tests * fix another test * fix ui tests * update test * fix evolution icon bug * Update TreemapVisualization and update expected screenshots * update screenshots
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Annotations/templates/getEvolutionIcons.twig2
-rw-r--r--plugins/CoreHome/javascripts/materialize-bc.js4
-rw-r--r--plugins/CoreHome/lang/en.json3
-rw-r--r--plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js2
-rw-r--r--plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png4
-rw-r--r--plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png4
-rw-r--r--plugins/Diagnostics/Diagnostic/ConfigInformational.php1
-rw-r--r--plugins/Diagnostics/Diagnostic/CronArchivingCheck.php26
-rw-r--r--plugins/Diagnostics/Diagnostic/CronArchivingLastRunCheck.php4
-rw-r--r--plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png4
-rw-r--r--plugins/Installation/lang/en.json7
-rw-r--r--plugins/Installation/stylesheets/systemCheckPage.less15
-rw-r--r--plugins/Installation/templates/finished.twig4
-rw-r--r--plugins/Installation/templates/getSystemCheckWidget.twig34
-rw-r--r--plugins/Installation/tests/UI/expected-screenshots/Installation_congrats.png4
-rw-r--r--plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png4
-rw-r--r--plugins/Marketplace/tests/UI/expected-screenshots/Marketplace_updates_multiUserEnvironment.png4
-rw-r--r--plugins/SegmentEditor/API.php18
-rw-r--r--plugins/SegmentEditor/SegmentEditor.php20
-rw-r--r--plugins/SegmentEditor/SegmentSelectorControl.php1
-rw-r--r--plugins/SegmentEditor/templates/_segmentSelector.twig8
-rw-r--r--plugins/SegmentEditor/tests/Integration/ApiTest.php3
-rw-r--r--plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php24
-rw-r--r--plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php5
-rw-r--r--plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php26
25 files changed, 156 insertions, 75 deletions
diff --git a/plugins/Annotations/templates/getEvolutionIcons.twig b/plugins/Annotations/templates/getEvolutionIcons.twig
index f4a26700c4..43eedbee9c 100644
--- a/plugins/Annotations/templates/getEvolutionIcons.twig
+++ b/plugins/Annotations/templates/getEvolutionIcons.twig
@@ -8,7 +8,7 @@
(counts.note|e('html_attr')))|raw }}
{{ 'Annotations_ClickToEditOrAdd'|translate }}"
{% else %}}title="{{ 'Annotations_ViewAndAddAnnotations'|translate(date) }}"{% endif %}>
- <span class="icon-annotation {% if counts.starred > 0 %}starred{% endif %}"/>
+ <span class="icon-annotation {% if counts.starred > 0 %}starred{% endif %}"></span>
</span>
{% endfor %}
</div>
diff --git a/plugins/CoreHome/javascripts/materialize-bc.js b/plugins/CoreHome/javascripts/materialize-bc.js
index 0bcede9018..e080a9ec74 100644
--- a/plugins/CoreHome/javascripts/materialize-bc.js
+++ b/plugins/CoreHome/javascripts/materialize-bc.js
@@ -5,6 +5,10 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
(function () {
+ jQuery.htmlPrefilter = function( html ) {
+ return html;
+ };
+
$(document).ready(function () {
window.Materialize = window.M;
$.fn.sideNav = $.fn.sidenav;
diff --git a/plugins/CoreHome/lang/en.json b/plugins/CoreHome/lang/en.json
index fb1ae8c3ec..752b760ab9 100644
--- a/plugins/CoreHome/lang/en.json
+++ b/plugins/CoreHome/lang/en.json
@@ -82,7 +82,8 @@
"PivotBySubtable": "This report is not pivoted %1$s Pivot by %2$s",
"SystemSummaryWidget": "System Summary",
"SystemSummaryNWebsites": "%d websites",
- "SystemSummaryNSegments": "%d segments",
+ "SystemSummaryNSegments": "%1$d segments",
+ "SystemSummaryNSegmentsWithBreakdown": "%1$d segments (%2$s pre-processed, %3$s processed in real-time)",
"SystemSummaryNActivatedPlugins": "%d activated plugins",
"SystemSummaryPiwikVersion": "Matomo version",
"SystemSummaryMysqlVersion": "MySQL version",
diff --git a/plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js b/plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js
index d214b8e3fb..7c52da0b8e 100644
--- a/plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js
+++ b/plugins/CoreVisualizations/javascripts/jqplotEvolutionGraph.js
@@ -114,7 +114,7 @@
var seriesColor = self.jqplotParams.seriesColors[d];
- dataByAxis[axis].push('<span class="tooltip-series-color" style="background-color: ' + seriesColor + ';"/>' + '<strong>' + value + '</strong> ' + piwikHelper.htmlEntities(series));
+ dataByAxis[axis].push('<span class="tooltip-series-color" style="background-color: ' + seriesColor + ';"></span>' + '<strong>' + value + '</strong> ' + piwikHelper.htmlEntities(series));
}
var xAxisCount = 0;
diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png
index e2a7456e5c..dd65b5ff03 100644
--- a/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png
+++ b/plugins/Dashboard/tests/UI/expected-screenshots/DashboardManager_removed.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:5e1dc0c291f09d57c6daead03c35a51603d46a310c4077e6d124bc92f68f383d
-size 480015
+oid sha256:5de1e4285b701c213440c36fad60f032b22b52ee40fb3246497801613c5d26c9
+size 484482
diff --git a/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png b/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png
index bd555e9535..1afaf6af53 100644
--- a/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png
+++ b/plugins/Dashboard/tests/UI/expected-screenshots/Dashboard_removed.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:63b5ba8e11faf3353ec7b8daa346fdc791d4204eb48f4b5a57efe50740d2f3e5
-size 747066
+oid sha256:a8772b0a0875f882449e1994c0f11f90bd6175372f10189dc338657f95b362b1
+size 749741
diff --git a/plugins/Diagnostics/Diagnostic/ConfigInformational.php b/plugins/Diagnostics/Diagnostic/ConfigInformational.php
index 1d3e9ec182..0a6bb5499f 100644
--- a/plugins/Diagnostics/Diagnostic/ConfigInformational.php
+++ b/plugins/Diagnostics/Diagnostic/ConfigInformational.php
@@ -33,7 +33,6 @@ class ConfigInformational implements Diagnostic
$results = [];
if (SettingsPiwik::isMatomoInstalled()) {
- $results[] = DiagnosticResult::informationalResult('Browser Archiving Enabled', Rules::isBrowserTriggerEnabled());
$results[] = DiagnosticResult::informationalResult('Browser Segment Archiving Enabled', Rules::isBrowserArchivingAvailableForSegments());
$results[] = DiagnosticResult::informationalResult('Development Mode Enabled', Development::isEnabled());
$results[] = DiagnosticResult::informationalResult('Internet Enabled',SettingsPiwik::isInternetEnabled());
diff --git a/plugins/Diagnostics/Diagnostic/CronArchivingCheck.php b/plugins/Diagnostics/Diagnostic/CronArchivingCheck.php
index 9500934b42..9d44e1393e 100644
--- a/plugins/Diagnostics/Diagnostic/CronArchivingCheck.php
+++ b/plugins/Diagnostics/Diagnostic/CronArchivingCheck.php
@@ -8,9 +8,11 @@
*/
namespace Piwik\Plugins\Diagnostics\Diagnostic;
+use Piwik\ArchiveProcessor\Rules;
use Piwik\CliMulti;
use Piwik\Config;
use Piwik\Http;
+use Piwik\SettingsPiwik;
use Piwik\Translation\Translator;
use Piwik\Url;
@@ -31,18 +33,34 @@ class CronArchivingCheck implements Diagnostic
public function execute()
{
- $label = $this->translator->translate('Installation_SystemCheckCronArchiveProcess');
- $comment = $this->translator->translate('Installation_SystemCheckCronArchiveProcessCLI') . ': ';
+ $label = $this->translator->translate('Installation_SystemCheckCronArchiveProcess') . ' (' .
+ $this->translator->translate('Installation_FasterReportLoading') . ')';
- $process = new CliMulti();
+ if (SettingsPiwik::isMatomoInstalled()) {
+ $isBrowserTriggerDisabled = !Rules::isBrowserTriggerEnabled();
+ if (!$isBrowserTriggerDisabled) {
+ $comment = $this->translator->translate('Diagnostics_BrowserTriggeredArchivingEnabled', [
+ '<a href="https://matomo.org/docs/setup-auto-archiving/" target="_blank" rel="noreferrer noopener">', '</a>']);
+ $result[] = DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment);
+ }
+ }
+
+ $comment = '';
+ $process = new CliMulti();
if ($process->supportsAsync()) {
$comment .= $this->translator->translate('General_Ok');
+ $status = DiagnosticResult::STATUS_OK;
} else {
$comment .= $this->translator->translate('Installation_NotSupported')
. ' ' . $this->translator->translate('Goals_Optional');
+ $status = DiagnosticResult::STATUS_INFORMATIONAL;
}
- return array(DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_OK, $comment));
+ $label = $this->translator->translate('Installation_SystemCheckCronArchiveProcess') . ' - '
+ . $this->translator->translate('Installation_SystemCheckCronArchiveProcessCLI');
+ $result[] = DiagnosticResult::singleResult($label, $status, $comment);
+
+ return $result;
}
}
diff --git a/plugins/Diagnostics/Diagnostic/CronArchivingLastRunCheck.php b/plugins/Diagnostics/Diagnostic/CronArchivingLastRunCheck.php
index ec5c8a3f74..cce7f95bcb 100644
--- a/plugins/Diagnostics/Diagnostic/CronArchivingLastRunCheck.php
+++ b/plugins/Diagnostics/Diagnostic/CronArchivingLastRunCheck.php
@@ -49,9 +49,7 @@ class CronArchivingLastRunCheck implements Diagnostic
// check cron archiving has been enabled
$isBrowserTriggerDisabled = !Rules::isBrowserTriggerEnabled();
if (!$isBrowserTriggerDisabled) {
- $comment = $this->translator->translate('Diagnostics_BrowserTriggeredArchivingEnabled', [
- '<a href="https://matomo.org/docs/setup-auto-archiving/" target="_blank" rel="noreferrer noopener">', '</a>']);
- return [DiagnosticResult::singleResult($label, DiagnosticResult::STATUS_WARNING, $comment)];
+ return [];
}
// check archiving has been run
diff --git a/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png b/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png
index 581764e419..8bfcb516df 100644
--- a/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png
+++ b/plugins/Diagnostics/tests/UI/expected-screenshots/Diagnostics_page.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:e35c892601ee82cca7b4927d06cf0b62d695764becaa79f49ce26c993f263886
-size 378134
+oid sha256:e02aaa3d918fb19ef242030fd7888b4122713be93ea4253d29859ff554a32cde
+size 374529
diff --git a/plugins/Installation/lang/en.json b/plugins/Installation/lang/en.json
index 1a11c998f1..0ee7272d45 100644
--- a/plugins/Installation/lang/en.json
+++ b/plugins/Installation/lang/en.json
@@ -131,7 +131,8 @@
"SystemCheckWriteDirs": "Directories with write access",
"SystemCheckWriteDirsHelp": "To fix this error on your GNU\/Linux system, try typing in the following command(s)",
"SystemCheckZlibHelp": "You need to configure and rebuild PHP with \"zlib\" support enabled, --with-zlib.",
- "SystemCheckCronArchiveProcess": "Archive Cron",
+ "SystemCheckCronArchiveProcess": "Setup Cron",
+ "FasterReportLoading": "faster report loading",
"SystemCheckCronArchiveProcessCLI": "Managing processes via CLI",
"SystemCheckPhpSetting": "To prevent some critical issue, you must set the following in your php.ini file: %s",
"SystemCheckUpdateHttps": "Update over HTTPS",
@@ -153,6 +154,8 @@
"WelcomeToCommunity": "Welcome to the Matomo community!",
"CannotConnectToDb": "Cannot connect to the database",
"CannotConnectToDbResolvingExplanation": "This may be a temporary issue, try %1$srefreshing the page%2$s. If the problem persists please contact your Matomo administrator.",
- "EmailPrivacyNotice": "Your email address will be only used to send you the newsletter. For this we have to share your email with a third party provider. This provider is currently Mad Mimi, but this may change in the future. We will not share your email with anyone else or use your email for any other purpose than sending you the newsletter. You can unsubscribe at any time. Please consult our %1$sprivacy policy%2$s for more information."
+ "EmailPrivacyNotice": "Your email address will be only used to send you the newsletter. For this we have to share your email with a third party provider. This provider is currently Mad Mimi, but this may change in the future. We will not share your email with anyone else or use your email for any other purpose than sending you the newsletter. You can unsubscribe at any time. Please consult our %1$sprivacy policy%2$s for more information.",
+ "PerformanceSettingsDesc1": "One final note regarding performance: your Matomo is setup and ready to track and report on your website's traffic, but if you find Matomo slow, you will want to take the extra step of setting up %1$sCLI archiving%2$s. This will generate your reports in the background periodically, rather than on demand.",
+ "PerformanceSettingsDesc2": "This requires adding a Matomo command to cron which can't be done automatically by the installer, but you can %1$sread our FAQ to learn how you can set it up yourself.%2$s"
}
}
diff --git a/plugins/Installation/stylesheets/systemCheckPage.less b/plugins/Installation/stylesheets/systemCheckPage.less
index 267b67ab49..d0c2293fce 100644
--- a/plugins/Installation/stylesheets/systemCheckPage.less
+++ b/plugins/Installation/stylesheets/systemCheckPage.less
@@ -40,8 +40,19 @@
ul {
li {
- list-style-type: disc;
- list-style-position: inside;
+ > span {
+ padding-right: 4px;
+ }
+
+ font-weight: bold;
+
+ &.system-check-widget-warning {
+ color: #DF9D27;
+ }
+
+ &.system-check-widget-error {
+ color: #D73F36;
+ }
}
}
}
diff --git a/plugins/Installation/templates/finished.twig b/plugins/Installation/templates/finished.twig
index 8cfa70ab23..52d7c8fd46 100644
--- a/plugins/Installation/templates/finished.twig
+++ b/plugins/Installation/templates/finished.twig
@@ -27,6 +27,10 @@
</p>
{% endif %}
+ <h3>Performance Settings</h3>
+ <p>{{ 'Installation_PerformanceSettingsDesc1'|translate('<a href="https://matomo.org/docs/setup-auto-archiving/" rel="noreferrer noopener" target="_blank">', '</a>')|raw }}</p>
+ <p>{{ 'Installation_PerformanceSettingsDesc2'|translate('<a href="https://matomo.org/docs/setup-auto-archiving/" rel="noreferrer noopener" target="_blank">', '</a>')|raw }}</p>
+
<h3>{{ 'Installation_DefaultSettings'|translate }}</h3>
<p>{{ 'Installation_DefaultSettingsHelp'|translate }}</p>
diff --git a/plugins/Installation/templates/getSystemCheckWidget.twig b/plugins/Installation/templates/getSystemCheckWidget.twig
index 5f1d9f8385..ec6fc72424 100644
--- a/plugins/Installation/templates/getSystemCheckWidget.twig
+++ b/plugins/Installation/templates/getSystemCheckWidget.twig
@@ -4,27 +4,17 @@
{% endif %}
{% if numErrors %}
- <p class="system-errors"><span class="icon-error"></span> {{ 'General_Errors'|translate }}</p>
<ul>
{% for error in errors %}
- <li title="{{ error.getLongErrorMessage|e('html_attr') }}">{{ error.getLabel }}</li>
+ <li title="{{ error.getLongErrorMessage|default(error.getItems()[0].getComment())|e('html_attr') }}" class="system-check-widget-error"><span class="icon-error"></span> {{ error.getLabel }}</li>
{% endfor %}
</ul>
{% endif %}
{% if numWarnings %}
-
- <p class="system-warnings">
-
- {% if numErrors %}
- <br />
- {% endif %}
-
- <span class="icon-warning"></span> {{ 'General_Warnings'|translate }}
- </p>
<ul>
{% for warning in warnings %}
- <li title="{{ warning.getLongErrorMessage|e('html_attr') }}">{{ warning.getLabel }}</li>
+ <li title="{{ warning.getLongErrorMessage|default(warning.getItems()[0].getComment())|e('html_attr') }}" class="system-check-widget-warning"><span class="icon-warning"></span> {{ warning.getLabel }}</li>
{% endfor %}
</ul>
{% endif %}
@@ -36,4 +26,24 @@
>{{ 'Installation_SystemCheckViewFullSystemCheck'|translate }}</a>
</p>
{% endif %}
+
+ <script>
+ jQuery(function () {
+ $('.widgetBody.system-check').tooltip({
+ track: true,
+ content: function() {
+ var $this = $(this);
+ if ($this.attr('piwik-field') === '') {
+ // do not show it for form fields
+ return '';
+ }
+
+ var title = $(this).attr('title');
+ return piwikHelper.escape(title.replace(/\n/g, '<br />'));
+ },
+ show: {delay: 200, duration: 100},
+ hide: false
+ });
+ });
+ </script>
</div> \ No newline at end of file
diff --git a/plugins/Installation/tests/UI/expected-screenshots/Installation_congrats.png b/plugins/Installation/tests/UI/expected-screenshots/Installation_congrats.png
index f7c080b3dd..89f503a929 100644
--- a/plugins/Installation/tests/UI/expected-screenshots/Installation_congrats.png
+++ b/plugins/Installation/tests/UI/expected-screenshots/Installation_congrats.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:2a4f17d196d9eac3a7b67b957ff164dfbc0290a7cbc7d3cac6021cbc751ad306
-size 197341
+oid sha256:2554655af0da05aaa8bf264ec54d14b93f7c2cb57f03367f8f1c27a0fa508696
+size 235575
diff --git a/plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png b/plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png
index 921a48a5ff..f0b6ece6da 100644
--- a/plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png
+++ b/plugins/Installation/tests/UI/expected-screenshots/Installation_system_check.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:b00ce0197290430e250acf1e0ba1e75dcf5a29a6e3167171335e0bd17e9e9959
-size 265318
+oid sha256:6697551f07ea985a5f58505eb262744cd995ce53d529b4f421944e27e48f8ef0
+size 265645
diff --git a/plugins/Marketplace/tests/UI/expected-screenshots/Marketplace_updates_multiUserEnvironment.png b/plugins/Marketplace/tests/UI/expected-screenshots/Marketplace_updates_multiUserEnvironment.png
index 23a4d2155d..47203bee06 100644
--- a/plugins/Marketplace/tests/UI/expected-screenshots/Marketplace_updates_multiUserEnvironment.png
+++ b/plugins/Marketplace/tests/UI/expected-screenshots/Marketplace_updates_multiUserEnvironment.png
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:1f2c89ade13fac9d0b808900ac20466815079ca14b8bcf1ac9abaed59ac79db4
-size 34054
+oid sha256:3d47e4600963d355dbdf42d6b0c052668a1c42316e7c4a08f486f0c264f7c5bb
+size 34101
diff --git a/plugins/SegmentEditor/API.php b/plugins/SegmentEditor/API.php
index f2c85c19bc..56cbe91282 100644
--- a/plugins/SegmentEditor/API.php
+++ b/plugins/SegmentEditor/API.php
@@ -9,6 +9,7 @@
namespace Piwik\Plugins\SegmentEditor;
use Exception;
+use Piwik\ArchiveProcessor\Rules;
use Piwik\Common;
use Piwik\Date;
use Piwik\Db;
@@ -107,16 +108,15 @@ class API extends \Piwik\Plugin\API
}
if ($autoArchive) {
- if ($realTimeSegmentsEnabled && !Piwik::isUserHasAdminAccess($idSite)) {
- // pre-processed segment for a given website requires admin access
- throw new Exception(
- "Please contact Support to make these changes on your behalf. ".
- " To modify a pre-processed segment, a user must have admin access or super user access. "
- );
- } elseif (!$realTimeSegmentsEnabled) {
- // we require view access only when only pre processed can be created
- Piwik::checkUserHasViewAccess($idSite);
+ if (Rules::isBrowserTriggerEnabled()) {
+ $message = "Pre-processed segments can only be created if browser triggered archiving is disabled.";
+ if (Piwik::hasUserSuperUserAccess()) {
+ $message .= " To disable browser archiving follow the instructions here: https://matomo.org/docs/setup-auto-archiving/.";
+ }
+ throw new Exception($message);
}
+
+ Piwik::checkUserHasViewAccess($idSite);
}
return $autoArchive;
diff --git a/plugins/SegmentEditor/SegmentEditor.php b/plugins/SegmentEditor/SegmentEditor.php
index 59ac72ee9c..9a6a4fd615 100644
--- a/plugins/SegmentEditor/SegmentEditor.php
+++ b/plugins/SegmentEditor/SegmentEditor.php
@@ -80,7 +80,25 @@ class SegmentEditor extends \Piwik\Plugin
$storedSegments = StaticContainer::get('Piwik\Plugins\SegmentEditor\Services\StoredSegmentService');
$segments = $storedSegments->getAllSegmentsAndIgnoreVisibility();
$numSegments = count($segments);
- $systemSummary[] = new SystemSummary\Item($key = 'segments', Piwik::translate('CoreHome_SystemSummaryNSegments', $numSegments), $value = null, $url = null, $icon = 'icon-segment', $order = 6);
+
+ if (Rules::isBrowserArchivingAvailableForSegments()) {
+ $numAutoArchiveSegments = 0;
+ $numRealTimeSegments = 0;
+ foreach ($segments as $segment) {
+ $autoArchive = (int)$segment['auto_archive'];
+ if (!empty($autoArchive)) {
+ ++$numAutoArchiveSegments;
+ } else {
+ ++$numRealTimeSegments;
+ }
+ }
+
+ $message = Piwik::translate('CoreHome_SystemSummaryNSegmentsWithBreakdown', [$numSegments, $numAutoArchiveSegments, $numRealTimeSegments]);
+ } else {
+ $message = Piwik::translate('CoreHome_SystemSummaryNSegments', [$numSegments]);
+ }
+
+ $systemSummary[] = new SystemSummary\Item($key = 'segments', $message, $value = null, $url = null, $icon = 'icon-segment', $order = 6);
}
function getSegmentEditorHtml(&$out)
diff --git a/plugins/SegmentEditor/SegmentSelectorControl.php b/plugins/SegmentEditor/SegmentSelectorControl.php
index c1f5c009a6..411209f1b9 100644
--- a/plugins/SegmentEditor/SegmentSelectorControl.php
+++ b/plugins/SegmentEditor/SegmentSelectorControl.php
@@ -86,6 +86,7 @@ class SegmentSelectorControl extends UIControl
'hideSegmentDefinitionChangeMessage',
Piwik::getCurrentUserLogin()
);
+ $this->isBrowserArchivingEnabled = Rules::isBrowserTriggerEnabled();
$this->isVisitorLogEnabled = Manager::getInstance()->isPluginActivated('Live') && Live::isVisitorLogEnabled($this->idSite);
}
diff --git a/plugins/SegmentEditor/templates/_segmentSelector.twig b/plugins/SegmentEditor/templates/_segmentSelector.twig
index 891b4c29a0..602b8a0dd4 100644
--- a/plugins/SegmentEditor/templates/_segmentSelector.twig
+++ b/plugins/SegmentEditor/templates/_segmentSelector.twig
@@ -43,8 +43,8 @@
{{ 'SegmentEditor_ThisSegmentIsVisibleTo'|translate }} <div class="enable_all_users"><strong>
<select class="enable_all_users_select">
- <option value="0">{{ 'SegmentEditor_VisibleToMe'|translate }}</option>
- <option selected="1" value="1">{{ 'SegmentEditor_VisibleToAllUsers'|translate }}</option>
+ <option {% if not isSuperUser %}selected="1"{% endif %} value="0">{{ 'SegmentEditor_VisibleToMe'|translate }}</option>
+ <option {% if isSuperUser %}selected="1"{% endif %} value="1">{{ 'SegmentEditor_VisibleToAllUsers'|translate }}</option>
</select>
</strong></div>
@@ -57,9 +57,9 @@
{{ 'General_And'|translate }} <div class="auto_archive"><strong>
<select class="auto_archive_select">
{% if createRealTimeSegmentsIsEnabled %}
- <option selected="1" value="0">{{ 'SegmentEditor_AutoArchiveRealTime'|translate }} {{ 'General_DefaultAppended'|translate }}</option>
+ <option {% if isBrowserArchivingEnabled %}selected="1"{% endif%} value="0">{{ 'SegmentEditor_AutoArchiveRealTime'|translate }} {{ 'General_DefaultAppended'|translate }}</option>
{% endif %}
- <option {% if not createRealTimeSegmentsIsEnabled %}selected="1"{% endif %} value="1">{{ 'SegmentEditor_AutoArchivePreProcessed'|translate }} </option>
+ <option {% if not isBrowserArchivingEnabled or not createRealTimeSegmentsIsEnabled %}selected="1"{% endif %} value="1">{{ 'SegmentEditor_AutoArchivePreProcessed'|translate }} </option>
</select>
</strong></div>
diff --git a/plugins/SegmentEditor/tests/Integration/ApiTest.php b/plugins/SegmentEditor/tests/Integration/ApiTest.php
index 88bef59bad..13e0fd3357 100644
--- a/plugins/SegmentEditor/tests/Integration/ApiTest.php
+++ b/plugins/SegmentEditor/tests/Integration/ApiTest.php
@@ -8,6 +8,7 @@
namespace Piwik\Plugins\SegmentEditor\tests\Integration;
+use Piwik\ArchiveProcessor\Rules;
use Piwik\Plugins\SegmentEditor\API;
use Piwik\Tests\Framework\Fixture;
use Piwik\Tests\Framework\Mock\FakeAccess;
@@ -152,6 +153,7 @@ class ApiTest extends IntegrationTestCase
*/
protected function createSegments()
{
+ Rules::setBrowserTriggerArchiving(false);
$this->setAdminUser();
$this->api->add('segment 1', 'visitCount<2', $idSite = 1, $autoArchive = true, $enableAllUsers = false);
$this->api->add('segment 2', 'countryCode==fr', $idSite = 2, $autoArchive = false, $enableAllUsers = false);
@@ -170,6 +172,7 @@ class ApiTest extends IntegrationTestCase
$this->setAnotherSuperUser();
$this->api->add('segment 9', 'countryCode!=fr', $idSite = false, $autoArchive = false, $enableAllUsers = true);
+ Rules::setBrowserTriggerArchiving(true);
}
diff --git a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php
index 07e2152739..95ed3c12bb 100644
--- a/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php
+++ b/plugins/SegmentEditor/tests/Integration/SegmentEditorTest.php
@@ -8,6 +8,7 @@
namespace Piwik\Plugins\SegmentEditor\tests\Integration;
+use Piwik\ArchiveProcessor\Rules;
use Piwik\Date;
use Piwik\Piwik;
use Piwik\Plugins\SegmentEditor\API;
@@ -47,16 +48,13 @@ class SegmentEditorTest extends IntegrationTestCase
*/
public function testAddInvalidSegment_ShouldThrow()
{
- try {
- API::getInstance()->add('name', 'test==test2');
- $this->fail("Exception not raised.");
- } catch (Exception $expected) {
- }
- try {
- API::getInstance()->add('name', 'test');
- $this->fail("Exception not raised.");
- } catch (Exception $expected) {
- }
+ $this->expectException(\Exception::class);
+
+ API::getInstance()->add('name', 'test==test2');
+ $this->fail("Exception not raised.");
+
+ API::getInstance()->add('name', 'test');
+ $this->fail("Exception not raised.");
}
/**
@@ -90,6 +88,8 @@ class SegmentEditorTest extends IntegrationTestCase
*/
public function test_AddAndGet_AnotherSegment()
{
+ Rules::setBrowserTriggerArchiving(false);
+
$name = 'name';
$definition = 'searches>1,visitIp!=127.0.0.1';
$idSegment = API::getInstance()->add($name, $definition, $idSite = 1, $autoArchive = 1, $enabledAllUsers = 1);
@@ -135,6 +135,8 @@ class SegmentEditorTest extends IntegrationTestCase
*/
public function test_UpdateSegment()
{
+ Rules::setBrowserTriggerArchiving(false);
+
$name = 'name"';
$definition = 'searches>1,visitIp!=127.0.0.1';
$nameSegment1 = 'hello';
@@ -179,6 +181,8 @@ class SegmentEditorTest extends IntegrationTestCase
*/
public function test_deleteSegment()
{
+ Rules::setBrowserTriggerArchiving(false);
+
$idSegment1 = API::getInstance()->add('name 1', 'searches==0', $idSite = 1, $autoArchive = 1, $enabledAllUsers = 1);
$idSegment2 = API::getInstance()->add('name 2', 'searches>1,visitIp!=127.0.0.1', $idSite = 1, $autoArchive = 1, $enabledAllUsers = 1);
diff --git a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php
index e9d18a63fd..7cf0c46de3 100644
--- a/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php
+++ b/plugins/SegmentEditor/tests/Integration/SegmentQueryDecoratorTest.php
@@ -8,6 +8,7 @@
namespace Piwik\Plugins\SegmentEditor\tests\Integration;
+use Piwik\ArchiveProcessor\Rules;
use Piwik\Plugins\SegmentEditor\API;
use Piwik\Plugins\SegmentEditor\SegmentQueryDecorator;
use Piwik\Segment;
@@ -36,6 +37,8 @@ class SegmentQueryDecoratorTest extends IntegrationTestCase
$this->segmentQueryDecorator = self::$fixture->piwikEnvironment->getContainer()->get(
'Piwik\Plugins\SegmentEditor\SegmentQueryDecorator');
+ Rules::setBrowserTriggerArchiving(false);
+
/** @var API $segmentEditorApi */
$segmentEditorApi = self::$fixture->piwikEnvironment->getContainer()->get(
'Piwik\Plugins\SegmentEditor\API');
@@ -47,6 +50,8 @@ class SegmentQueryDecoratorTest extends IntegrationTestCase
// test that segments w/ auto archive == false are included
$segmentEditorApi->add('segment 5', 'visitCount<2', 3, $autoArchive = false);
$segmentEditorApi->add('segment 6', 'countryCode!=fr', 3, $autoArchive = false);
+
+ Rules::setBrowserTriggerArchiving(true);
}
/**
diff --git a/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php b/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php
index ebb5656e5f..0d0f78c3c4 100644
--- a/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php
+++ b/plugins/SegmentEditor/tests/System/UnprocessedSegmentsTest.php
@@ -69,13 +69,13 @@ class UnprocessedSegmentsTest extends IntegrationTestCase
public function test_apiOutput_whenUnprocessedAutoArchiveSegmentUsed_WithBrowserArchivingDisabled()
{
+ Rules::setBrowserTriggerArchiving(false);
+
$idSegment = API::getInstance()->add('testsegment', self::TEST_SEGMENT, self::$fixture->idSite, $autoArchive = true);
$storedSegment = API::getInstance()->get($idSegment);
$this->assertNotEmpty($storedSegment);
- Rules::setBrowserTriggerArchiving(false);
-
$segments = Rules::getSegmentsToProcess([self::$fixture->idSite]);
self::assertTrue(in_array(self::TEST_SEGMENT, $segments));
@@ -89,13 +89,13 @@ class UnprocessedSegmentsTest extends IntegrationTestCase
public function test_apiOutput_whenUnprocessedAutoArchiveSegmentUsed_WithBrowserArchivingDisabled_AndEncodedSegment()
{
+ Rules::setBrowserTriggerArchiving(false);
+
$idSegment = API::getInstance()->add('testsegment', self::TEST_SEGMENT, self::$fixture->idSite, $autoArchive = true);
$storedSegment = API::getInstance()->get($idSegment);
$this->assertNotEmpty($storedSegment);
- Rules::setBrowserTriggerArchiving(false);
-
$segments = Rules::getSegmentsToProcess([self::$fixture->idSite]);
self::assertTrue(in_array(self::TEST_SEGMENT, $segments));
@@ -109,14 +109,16 @@ class UnprocessedSegmentsTest extends IntegrationTestCase
public function test_apiOutput_whenPreprocessedSegmentUsed_WithBrowserArchivingDisabled()
{
+ Rules::setBrowserTriggerArchiving(false);
+
$idSegment = API::getInstance()->add('testsegment', self::TEST_SEGMENT, self::$fixture->idSite, $autoArchive = true);
$storedSegment = API::getInstance()->get($idSegment);
$this->assertNotEmpty($storedSegment);
+ Rules::setBrowserTriggerArchiving(true);
VisitsSummary\API::getInstance()->get(self::$fixture->idSite, 'week',
- Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive
-
+ Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive (make sure there's data for actual test)
Rules::setBrowserTriggerArchiving(false);
$segments = Rules::getSegmentsToProcess([self::$fixture->idSite]);
@@ -152,6 +154,8 @@ class UnprocessedSegmentsTest extends IntegrationTestCase
{
$this->clearLogData();
+ Rules::setBrowserTriggerArchiving(false);
+
$idSegment = API::getInstance()->add('testsegment', self::TEST_SEGMENT, self::$fixture->idSite, $autoArchive = true);
$storedSegment = API::getInstance()->get($idSegment);
@@ -160,8 +164,6 @@ class UnprocessedSegmentsTest extends IntegrationTestCase
VisitsSummary\API::getInstance()->get(self::$fixture->idSite, 'week',
Date::factory(self::$fixture->dateTime)->toString(), self::TEST_SEGMENT); // archive
- Rules::setBrowserTriggerArchiving(false);
-
$segments = Rules::getSegmentsToProcess([self::$fixture->idSite]);
self::assertTrue(in_array(self::TEST_SEGMENT, $segments));
@@ -177,13 +179,13 @@ class UnprocessedSegmentsTest extends IntegrationTestCase
{
$this->clearLogData();
+ Rules::setBrowserTriggerArchiving(false);
+
$idSegment = API::getInstance()->add('testsegment', self::TEST_SEGMENT, self::$fixture->idSite, $autoArchive = true);
$storedSegment = API::getInstance()->get($idSegment);
$this->assertNotEmpty($storedSegment);
- Rules::setBrowserTriggerArchiving(false);
-
$segments = Rules::getSegmentsToProcess([self::$fixture->idSite]);
self::assertTrue(in_array(self::TEST_SEGMENT, $segments));
@@ -197,13 +199,13 @@ class UnprocessedSegmentsTest extends IntegrationTestCase
public function test_apiOutput_whenMultipleSitesRequested_OneWithDataOneNot_AndBrowserArchivingDisabled()
{
+ Rules::setBrowserTriggerArchiving(false);
+
$idSegment = API::getInstance()->add('testsegment', self::TEST_SEGMENT, $idSite = false, $autoArchive = true);
$storedSegment = API::getInstance()->get($idSegment);
$this->assertNotEmpty($storedSegment);
- Rules::setBrowserTriggerArchiving(false);
-
$segments = Rules::getSegmentsToProcess([self::$fixture->idSite]);
self::assertTrue(in_array(self::TEST_SEGMENT, $segments));