update Piwik to version 2.16 (fixes #91)
This commit is contained in:
parent
296343bf3b
commit
d885a4baa9
5833 changed files with 418860 additions and 226988 deletions
29
www/analytics/plugins/Monolog/config/cli.php
Normal file
29
www/analytics/plugins/Monolog/config/cli.php
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<?php
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
use Monolog\Logger;
|
||||
use Symfony\Bridge\Monolog\Formatter\ConsoleFormatter;
|
||||
use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
|
||||
return array(
|
||||
|
||||
// Log
|
||||
'log.handlers' => array(
|
||||
DI\get('Symfony\Bridge\Monolog\Handler\ConsoleHandler'),
|
||||
),
|
||||
'Symfony\Bridge\Monolog\Handler\ConsoleHandler' => function (ContainerInterface $c) {
|
||||
// Override the default verbosity map to make it more verbose by default
|
||||
$verbosityMap = array(
|
||||
OutputInterface::VERBOSITY_NORMAL => Logger::INFO,
|
||||
OutputInterface::VERBOSITY_VERBOSE => Logger::DEBUG,
|
||||
OutputInterface::VERBOSITY_VERY_VERBOSE => Logger::DEBUG,
|
||||
OutputInterface::VERBOSITY_DEBUG => Logger::DEBUG,
|
||||
);
|
||||
$handler = new ConsoleHandler(null, true, $verbosityMap);
|
||||
$handler->setFormatter(new ConsoleFormatter($c->get('log.console.format'), null, true, true));
|
||||
return $handler;
|
||||
},
|
||||
'log.console.format' => '%start_tag%%level_name% [%datetime%]%end_tag% %message%' . PHP_EOL,
|
||||
|
||||
);
|
||||
108
www/analytics/plugins/Monolog/config/config.php
Normal file
108
www/analytics/plugins/Monolog/config/config.php
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
<?php
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
use Monolog\Logger;
|
||||
use Piwik\Log;
|
||||
|
||||
return array(
|
||||
|
||||
'Monolog\Logger' => DI\object('Monolog\Logger')
|
||||
->constructor('piwik', DI\get('log.handlers'), DI\get('log.processors')),
|
||||
|
||||
'Psr\Log\LoggerInterface' => DI\get('Monolog\Logger'),
|
||||
|
||||
'log.handler.classes' => array(
|
||||
'file' => 'Piwik\Plugins\Monolog\Handler\FileHandler',
|
||||
'screen' => 'Piwik\Plugins\Monolog\Handler\WebNotificationHandler',
|
||||
'database' => 'Piwik\Plugins\Monolog\Handler\DatabaseHandler',
|
||||
),
|
||||
'log.handlers' => DI\factory(function (ContainerInterface $c) {
|
||||
if ($c->has('ini.log.log_writers')) {
|
||||
$writerNames = $c->get('ini.log.log_writers');
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
|
||||
$classes = $c->get('log.handler.classes');
|
||||
|
||||
$writerNames = array_map('trim', $writerNames);
|
||||
$writers = array();
|
||||
foreach ($writerNames as $writerName) {
|
||||
if (isset($classes[$writerName])) {
|
||||
$writers[$writerName] = $c->get($classes[$writerName]);
|
||||
}
|
||||
}
|
||||
return array_values($writers);
|
||||
}),
|
||||
|
||||
'log.processors' => array(
|
||||
DI\get('Piwik\Plugins\Monolog\Processor\SprintfProcessor'),
|
||||
DI\get('Piwik\Plugins\Monolog\Processor\ClassNameProcessor'),
|
||||
DI\get('Piwik\Plugins\Monolog\Processor\RequestIdProcessor'),
|
||||
DI\get('Piwik\Plugins\Monolog\Processor\ExceptionToTextProcessor'),
|
||||
DI\get('Monolog\Processor\PsrLogMessageProcessor'),
|
||||
DI\get('Piwik\Plugins\Monolog\Processor\TokenProcessor'),
|
||||
),
|
||||
|
||||
'Piwik\Plugins\Monolog\Handler\FileHandler' => DI\object()
|
||||
->constructor(DI\get('log.file.filename'), DI\get('log.level'))
|
||||
->method('setFormatter', DI\get('log.lineMessageFormatter.file')),
|
||||
|
||||
'log.lineMessageFormatter.file' => DI\object('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter')
|
||||
->constructorParameter('allowInlineLineBreaks', false),
|
||||
|
||||
'Piwik\Plugins\Monolog\Handler\DatabaseHandler' => DI\object()
|
||||
->constructor(DI\get('log.level'))
|
||||
->method('setFormatter', DI\get('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter')),
|
||||
|
||||
'Piwik\Plugins\Monolog\Handler\WebNotificationHandler' => DI\object()
|
||||
->constructor(DI\get('log.level'))
|
||||
->method('setFormatter', DI\get('Piwik\Plugins\Monolog\Formatter\LineMessageFormatter')),
|
||||
|
||||
'log.level' => DI\factory(function (ContainerInterface $c) {
|
||||
if ($c->has('ini.log.log_level')) {
|
||||
$level = strtoupper($c->get('ini.log.log_level'));
|
||||
if (!empty($level) && defined('Piwik\Log::'.strtoupper($level))) {
|
||||
return Log::getMonologLevel(constant('Piwik\Log::'.strtoupper($level)));
|
||||
}
|
||||
}
|
||||
return Logger::WARNING;
|
||||
}),
|
||||
|
||||
'log.file.filename' => DI\factory(function (ContainerInterface $c) {
|
||||
$logPath = $c->get('ini.log.logger_file_path');
|
||||
|
||||
// Absolute path
|
||||
if (strpos($logPath, '/') === 0) {
|
||||
return $logPath;
|
||||
}
|
||||
|
||||
// Remove 'tmp/' at the beginning
|
||||
if (strpos($logPath, 'tmp/') === 0) {
|
||||
$logPath = substr($logPath, strlen('tmp'));
|
||||
}
|
||||
|
||||
if (empty($logPath)) {
|
||||
// Default log file
|
||||
$logPath = '/logs/piwik.log';
|
||||
}
|
||||
|
||||
$logPath = $c->get('path.tmp') . $logPath;
|
||||
if (is_dir($logPath)) {
|
||||
$logPath .= '/piwik.log';
|
||||
}
|
||||
|
||||
return $logPath;
|
||||
}),
|
||||
|
||||
'Piwik\Plugins\Monolog\Formatter\LineMessageFormatter' => DI\object()
|
||||
->constructor(DI\get('log.format')),
|
||||
|
||||
'log.format' => DI\factory(function (ContainerInterface $c) {
|
||||
if ($c->has('ini.log.string_message_format')) {
|
||||
return $c->get('ini.log.string_message_format');
|
||||
}
|
||||
return '%level% %tag%[%datetime%] %message%';
|
||||
}),
|
||||
|
||||
);
|
||||
37
www/analytics/plugins/Monolog/config/tracker.php
Normal file
37
www/analytics/plugins/Monolog/config/tracker.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
use Interop\Container\ContainerInterface;
|
||||
|
||||
function isTrackerDebugEnabled(ContainerInterface $c)
|
||||
{
|
||||
$trackerDebug = $c->get("ini.Tracker.debug");
|
||||
return ($trackerDebug == 1 || !empty($GLOBALS['PIWIK_TRACKER_DEBUG']));
|
||||
}
|
||||
|
||||
return array(
|
||||
|
||||
'Psr\Log\LoggerInterface' => function (ContainerInterface $c) {
|
||||
if (isTrackerDebugEnabled($c)) {
|
||||
return $c->get('Monolog\Logger');
|
||||
} else {
|
||||
return new \Psr\Log\NullLogger();
|
||||
}
|
||||
},
|
||||
|
||||
'log.handler.classes' => DI\decorate(function ($previous) {
|
||||
if (isset($previous['screen'])) {
|
||||
$previous['screen'] = 'Piwik\Plugins\Monolog\Handler\EchoHandler';
|
||||
}
|
||||
|
||||
return $previous;
|
||||
}),
|
||||
|
||||
'log.level' => DI\decorate(function ($previous, ContainerInterface $c) {
|
||||
if (isTrackerDebugEnabled($c)) {
|
||||
return \Monolog\Logger::DEBUG;
|
||||
}
|
||||
|
||||
return $previous;
|
||||
})
|
||||
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue