diff --git a/config/environment/cli.php b/config/environment/cli.php deleted file mode 100644 index 0db3009ad4a3bb580511c1554f82d9117016d305..0000000000000000000000000000000000000000 --- a/config/environment/cli.php +++ /dev/null @@ -1,29 +0,0 @@ -<?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% %extra.class%[%datetime%]%end_tag% %message%' . PHP_EOL, - -); diff --git a/core/Container/ContainerFactory.php b/core/Container/ContainerFactory.php index af2a09b695d4f260a3875e93ac7413725d42f6c5..9abad4f5ce4116a22bd940167011742656ae5126 100644 --- a/core/Container/ContainerFactory.php +++ b/core/Container/ContainerFactory.php @@ -90,7 +90,9 @@ class ContainerFactory $file = sprintf('%s/config/environment/%s.php', PIWIK_USER_PATH, $this->environment); - $builder->addDefinitions($file); + if (file_exists($file)) { + $builder->addDefinitions($file); + } } private function addPluginConfigs(ContainerBuilder $builder) @@ -98,13 +100,17 @@ class ContainerFactory $plugins = Manager::getInstance()->getActivatedPluginsFromConfig(); foreach ($plugins as $plugin) { - $file = Manager::getPluginsDirectory() . $plugin . '/config/config.php'; + $baseDir = Manager::getPluginsDirectory() . $plugin; - if (! file_exists($file)) { - continue; + $file = $baseDir . '/config/config.php'; + if (file_exists($file)) { + $builder->addDefinitions($file); } - $builder->addDefinitions($file); + $environmentFile = $baseDir . '/config/' . $this->environment . '.php'; + if (file_exists($environmentFile)) { + $builder->addDefinitions($environmentFile); + } } } } diff --git a/piwik.php b/piwik.php index 95cc6271f185fed89d302e27ec1e90fb8a992acc..dcca10e40837b93754385ba659e333320881d509 100644 --- a/piwik.php +++ b/piwik.php @@ -48,6 +48,10 @@ require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Cache.php'; require_once PIWIK_INCLUDE_PATH . '/core/Tracker/Request.php'; require_once PIWIK_INCLUDE_PATH . '/core/Cookie.php'; +\Piwik\Container\StaticContainer::setEnvironment('tracker'); + +\Piwik\Profiler::setupProfilerXHProf(true, true); + Tracker::loadTrackerEnvironment(); $tracker = new Tracker(); diff --git a/plugins/Monolog/config/config.php b/plugins/Monolog/config/config.php index 3fd3fcf63a75067280d2abdfaaba8caee9f9e19b..22cf7debeeb94d5e3c668338b0264b266c315b6d 100644 --- a/plugins/Monolog/config/config.php +++ b/plugins/Monolog/config/config.php @@ -6,9 +6,11 @@ use Piwik\Log; return array( - 'Psr\Log\LoggerInterface' => DI\object('Monolog\Logger') + 'Monolog\Logger' => DI\object('Monolog\Logger') ->constructor('piwik', DI\get('log.handlers'), DI\get('log.processors')), + 'Psr\Log\LoggerInterface' => DI\get('Monolog\Logger'), + 'log.handlers' => DI\factory(function (ContainerInterface $c) { if ($c->has('ini.log.log_writers')) { $writerNames = $c->get('ini.log.log_writers');