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-02-29 12:25:27 +0300
committerdiosmosis <diosmosis@users.noreply.github.com>2020-02-29 12:25:27 +0300
commit76ee80a99b75f6c46ff9c28d9e02637987f74df6 (patch)
tree320c12221206593d17a3cea9106e6138bd03bfa3
parentb69301640344d280b03b09f427002a3ef96f6a90 (diff)
attempting to get to work on climulti requests, but strange DI issue is blocking15220-enable-fingers-crossed
-rw-r--r--core/CliMulti/RequestCommand.php6
-rw-r--r--plugins/Monolog/config/climulti.php28
-rw-r--r--plugins/Monolog/config/config.php2
3 files changed, 35 insertions, 1 deletions
diff --git a/core/CliMulti/RequestCommand.php b/core/CliMulti/RequestCommand.php
index 5385042054..faa434b1fa 100644
--- a/core/CliMulti/RequestCommand.php
+++ b/core/CliMulti/RequestCommand.php
@@ -8,15 +8,19 @@
namespace Piwik\CliMulti;
+use Monolog\Logger;
use Piwik\Application\Environment;
use Piwik\Access;
+use Piwik\Config;
use Piwik\Container\StaticContainer;
use Piwik\Db;
use Piwik\Log;
use Piwik\Option;
use Piwik\Plugin\ConsoleCommand;
+use Piwik\Plugins\Monolog\Handler\EchoHandler;
use Piwik\Url;
use Piwik\UrlHelper;
+use Psr\Container\ContainerInterface;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
@@ -116,7 +120,7 @@ class RequestCommand extends ConsoleCommand
StaticContainer::clearContainer();
Log::unsetInstance();
- $this->environment = new Environment(null);
+ $this->environment = new Environment('climulti');
$this->environment->init();
}
diff --git a/plugins/Monolog/config/climulti.php b/plugins/Monolog/config/climulti.php
new file mode 100644
index 0000000000..37907a1869
--- /dev/null
+++ b/plugins/Monolog/config/climulti.php
@@ -0,0 +1,28 @@
+<?php
+/**
+ * Piwik - free/libre analytics platform
+ *
+ * @link https://matomo.org
+ * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
+ */
+
+use Monolog\Logger;
+use Piwik\Plugins\Monolog\Handler\EchoHandler;
+use Psr\Container\ContainerInterface;
+
+return [
+ 'log.handlers' => \DI\decorate(function ($previous, ContainerInterface $c) {
+ if ($c->get('ini.log.enable_fingers_crossed_handler')) {
+ $handler = new EchoHandler();
+
+ $passthruLevel = $handler->getLevel();
+ $handler->setLevel(Logger::DEBUG);
+
+ $handler = new \Monolog\Handler\FingersCrossedHandler($handler, $activationStrategy = null, $bufferSize = 0,
+ $bubble = true, false, $passthruLevel);
+
+ $previous = array_merge([$handler], $previous ?: []);
+ }
+ return $previous;
+ }),
+]; \ No newline at end of file
diff --git a/plugins/Monolog/config/config.php b/plugins/Monolog/config/config.php
index 13fef1ce02..355b290c04 100644
--- a/plugins/Monolog/config/config.php
+++ b/plugins/Monolog/config/config.php
@@ -19,6 +19,7 @@ return array(
'database' => 'Piwik\Plugins\Monolog\Handler\DatabaseHandler',
),
'log.handlers' => DI\factory(function (\DI\Container $c) {
+ // TODO: move all this and related code to a FingersCrossedHandler that can be unit tested
if ($c->has('ini.log.log_writers')) {
$writerNames = $c->get('ini.log.log_writers');
} else {
@@ -27,6 +28,7 @@ return array(
$classes = $c->get('log.handler.classes');
+ // TODO: use DI, ini settings
$logConfig = $c->get(\Piwik\Config::class)->log;
$enableFingersCrossed = isset($logConfig['enable_fingers_crossed_handler']) && $logConfig['enable_fingers_crossed_handler'] == 1;
$fingersCrossedStopBuffering = isset($logConfig['fingers_crossed_stop_buffering_on_activation']) && $logConfig['fingers_crossed_stop_buffering_on_activation'] == 1;