Skip to content

Commit 374b6ff

Browse files
committed
Config updater
1 parent e2071e4 commit 374b6ff

3 files changed

Lines changed: 36 additions & 9 deletions

File tree

SystemSettings.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -343,14 +343,7 @@ private function createBackendSetting()
343343
}
344344

345345
private function createUseWhatRedisBackendType()
346-
{
347-
$old_useSentinelBackend = new SystemSetting('useSentinelBackend', $default = false, FieldConfig::TYPE_BOOL, $this->pluginName);
348-
$tmp_useWhatRedisBackendType = new SystemSetting('useWhatRedisBackendType', $default = 0, FieldConfig::TYPE_INT, $this->pluginName);
349-
if ($tmp_useWhatRedisBackendType->getValue() == 0) {
350-
$tmp_useWhatRedisBackendType->setValue($old_useSentinelBackend->getValue() == true ? 2 : 1);
351-
parent::save();
352-
}
353-
346+
{
354347
return $this->makeSetting('useWhatRedisBackendType', $default = 0, FieldConfig::TYPE_INT, function (FieldConfig $field) {
355348
$field->title = 'Redis type';
356349
$field->uiControl = FieldConfig::UI_CONTROL_RADIO;

Updates/5.0.8.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Matomo - free/libre analytics platform
4+
*
5+
* @link https://matomo.org
6+
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
7+
*
8+
*/
9+
10+
namespace Piwik\Plugins\QueuedTracking;
11+
12+
use Piwik\Updater;
13+
use Piwik\Updates as PiwikUpdates;
14+
use Piwik\Updater\Migration\Factory as MigrationFactory;
15+
use Piwik\Settings\Plugin\SystemSetting;
16+
use Piwik\Settings\FieldConfig;
17+
18+
/**
19+
* Update for version 5.0.8.
20+
*/
21+
class Updates_5_0_8 extends PiwikUpdates
22+
{
23+
public function __construct(MigrationFactory $factory) {}
24+
25+
public function doUpdate(Updater $updater)
26+
{
27+
$old_useSentinelBackend = new SystemSetting('useSentinelBackend', $default = false, FieldConfig::TYPE_BOOL, 'QueuedTracking');
28+
$tmp_useWhatRedisBackendType = new SystemSetting('useWhatRedisBackendType', $default = 0, FieldConfig::TYPE_INT, 'QueuedTracking');
29+
if ($tmp_useWhatRedisBackendType->getValue() == 0) {
30+
$tmp_useWhatRedisBackendType->setValue($old_useSentinelBackend->getValue() == true ? 2 : 1);
31+
$tmp_useWhatRedisBackendType->save();
32+
}
33+
}
34+
}

plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "QueuedTracking",
3-
"version": "5.0.7",
3+
"version": "5.0.8",
44
"description": "Scale your large traffic Matomo service by queuing tracking requests in Redis or MySQL for better performance and reliability when experiencing peaks.",
55
"theme": false,
66
"keywords": ["tracker", "tracking", "queue", "redis"],

0 commit comments

Comments
 (0)