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
path: root/misc
diff options
context:
space:
mode:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-12-10 00:05:12 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-12-10 00:05:12 +0300
commitaad92e94052b7fe0cc617ec52e09c8a295c9ed4b (patch)
treeb25c42fc76b384919ea63519dc78fb9906dfebb6 /misc
parent4edf7de1133a6aa52cfcae8666d5827cbffa8c94 (diff)
#6622 Logger refactoring: log as in CLI with PHP-CGI for the archiving
Diffstat (limited to 'misc')
-rw-r--r--misc/cron/archive.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/misc/cron/archive.php b/misc/cron/archive.php
index 0d59036d79..3abd5b0ccb 100644
--- a/misc/cron/archive.php
+++ b/misc/cron/archive.php
@@ -9,6 +9,11 @@
* @package Piwik
*/
+use Piwik\Container\StaticContainer;
+use Symfony\Bridge\Monolog\Handler\ConsoleHandler;
+use Symfony\Component\Console\Output\ConsoleOutput;
+use Symfony\Component\Console\Output\OutputInterface;
+
if (!defined('PIWIK_INCLUDE_PATH')) {
define('PIWIK_INCLUDE_PATH', realpath(dirname(__FILE__) . "/../.."));
}
@@ -55,6 +60,16 @@ if (isset($_SERVER['argv']) && Piwik\Console::isSupported()) {
$console->run();
} else { // if running via web request, use CronArchive directly
+
+ if (Piwik\Common::isPhpCliMode()) {
+ // We can run the archive in CLI with `php-cgi` so we have to configure the container/logger
+ // just like for CLI
+ StaticContainer::loadCliConfig();
+ /** @var ConsoleHandler $consoleLogHandler */
+ $consoleLogHandler = StaticContainer::getContainer()->get('Symfony\Bridge\Monolog\Handler\ConsoleHandler');
+ $consoleLogHandler->setOutput(new ConsoleOutput(OutputInterface::VERBOSITY_VERBOSE));
+ }
+
$archiver = new Piwik\CronArchive();
if (!Piwik\Common::isPhpCliMode()) {