diff --git a/config/global.ini.php b/config/global.ini.php index c8049e52f39bc8aa78c8cb0fed43ae66722549f0..decf36869e46d3870dd0cbe3fca32723b80c1d83 100644 --- a/config/global.ini.php +++ b/config/global.ini.php @@ -136,6 +136,13 @@ anonymous_user_enable_use_segments_API = 1 ; The only time that the browser will still trigger archiving is when requesting a custom date range that is not pre-processed yet browser_archiving_disabled_enforce = 0 +; By default, users can create Segments which are to be processed in Real-time. +; Setting this to 0 will force all newly created Custom Segments to be "Pre-processed (faster, requires archive.php cron)" +; This can be useful if you want to prevent users from adding much load on the server. +; Note: any existing Segment set to "processed in Real time", will still be set to Real-time. +; this will only affect custom segments added or modified after this setting is changed. +enable_create_realtime_segments = 1 + ; this action name is used when the URL ends with a slash / ; it is useful to have an actual string to write in the UI action_default_name = index diff --git a/plugins/SegmentEditor/SegmentSelectorControl.php b/plugins/SegmentEditor/SegmentSelectorControl.php index 1b28c7d89d4ff544b0d132b5b06ef9e289548fc9..78638a6523869514af65933fbc8f4c838229fbb2 100644 --- a/plugins/SegmentEditor/SegmentSelectorControl.php +++ b/plugins/SegmentEditor/SegmentSelectorControl.php @@ -53,6 +53,7 @@ class SegmentSelectorControl extends UIControl } uksort($segmentsByCategory, array($this, 'sortSegmentCategories')); + $this->createRealTimeSegmentsIsEnabled = Config::getInstance()->General['enable_create_realtime_segments']; $this->segmentsByCategory = $segmentsByCategory; $this->nameOfCurrentSegment = ''; $this->clientSideProperties['isSegmentNotAppliedBecauseBrowserArchivingIsDisabled'] = 0; @@ -62,7 +63,7 @@ class SegmentSelectorControl extends UIControl $savedSegment['name'] = Common::sanitizeInputValue($savedSegment['name']); if (!empty($this->selectedSegment) && $this->selectedSegment == $savedSegment['definition']) { - $this->nameOfCurrentSegment = $savedSegment['name']; + $this->nameOfCurrentSegment = $savedSegment['name']; $this->clientSideProperties['isSegmentNotAppliedBecauseBrowserArchivingIsDisabled'] = $this->wouldApplySegment($savedSegment) ? 0 : 1; } diff --git a/plugins/SegmentEditor/templates/_segmentSelector.twig b/plugins/SegmentEditor/templates/_segmentSelector.twig index 9dfb59a7d5a1d4a2f4dbec462fed657af66d3121..de4509fa26dc5d4659a270e6b58daffdca53f006 100644 --- a/plugins/SegmentEditor/templates/_segmentSelector.twig +++ b/plugins/SegmentEditor/templates/_segmentSelector.twig @@ -118,8 +118,10 @@ </strong></span> {{ 'General_And'|translate }} <span class="auto_archive"><strong> <select class="auto_archive_select"> + {% if createRealTimeSegmentsIsEnabled %} <option selected="1" value="0">{{ 'SegmentEditor_AutoArchiveRealTime'|translate }} {{ 'General_DefaultAppended'|translate }}</option> - <option value="1">{{ 'SegmentEditor_AutoArchivePreProcessed'|translate }} </option> + {% endif %} + <option {% if not createRealTimeSegmentsIsEnabled %}selected="1"{% endif %} value="1">{{ 'SegmentEditor_AutoArchivePreProcessed'|translate }} </option> </select> </strong></span>