forked from matomo-org/plugin-QueuedTracking
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathQueuedTracking.php
39 lines (32 loc) · 891 Bytes
/
QueuedTracking.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*
*/
namespace Piwik\Plugins\QueuedTracking;
use Piwik\Plugins\QueuedTracking\Tracker\Handler;
class QueuedTracking extends \Piwik\Plugin
{
/**
* @see Piwik\Plugin::getListHooksRegistered
*/
public function getListHooksRegistered()
{
return array(
'Tracker.newHandler' => 'replaceHandlerIfQueueIsEnabled'
);
}
public function replaceHandlerIfQueueIsEnabled(&$handler)
{
$settings = Queue\Factory::getSettings();
if ($settings->queueEnabled->getValue()) {
$handler = new Handler();
if ($settings->processDuringTrackingRequest->getValue()) {
$handler->enableProcessingInTrackerMode();
}
}
}
}