Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-03-01 21:53:21 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-03-01 21:53:21 +0300
commit7ccc0861b1a94de1cbced0daee9683e7e0696405 (patch)
tree593dc91df95276375f1679bfecf1f773431cd165 /lib
parent73efd7dab4e3a2f202df31d38ac69b049dc02c0e (diff)
Add console logging to the threading command
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-rw-r--r--lib/Command/Thread.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Command/Thread.php b/lib/Command/Thread.php
index 91588196e..3999abcc9 100644
--- a/lib/Command/Thread.php
+++ b/lib/Command/Thread.php
@@ -25,6 +25,7 @@ namespace OCA\Mail\Command;
use OCA\Mail\IMAP\Threading\DatabaseMessage;
use OCA\Mail\IMAP\Threading\ThreadBuilder;
+use OCA\Mail\Support\ConsoleLoggerDecorator;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
@@ -62,6 +63,11 @@ class Thread extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output): int {
+ $consoleLogger = new ConsoleLoggerDecorator(
+ $this->logger,
+ $output
+ );
+
$inputFile = $input->getArgument(self::ARGUMENT_INPUT_FILE);
if (!file_exists($inputFile)) {
@@ -74,7 +80,9 @@ class Thread extends Command {
$output->writeln("<error>Could not read thread data</error>");
return 2;
}
- $parsed = json_decode($json, true);
+ $consoleLogger->debug(strlen($json) . 'B read');
+ $parsed = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
+ $consoleLogger->debug(count($parsed) . ' data sets loaded');
$threadData = array_map(function ($serialized) {
return new DatabaseMessage(
$serialized['databaseId'],
@@ -85,7 +93,7 @@ class Thread extends Command {
);
}, $parsed);
- $threads = $this->builder->build($threadData, $this->logger);
+ $threads = $this->builder->build($threadData, $consoleLogger);
$output->writeln(count($threads) . " threads built from " . count($threadData) . " messages");
$mbs = (int)(memory_get_peak_usage() / 1024 / 1024);