mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
Enable _debug() for #325
This commit is contained in:
parent
81392ee8a0
commit
710659560b
1 changed files with 12 additions and 9 deletions
|
|
@ -38,8 +38,7 @@ class GPG
|
||||||
FD_MESSAGE = 5;
|
FD_MESSAGE = 5;
|
||||||
|
|
||||||
public
|
public
|
||||||
$strict = false,
|
$strict = false;
|
||||||
$debug = false;
|
|
||||||
|
|
||||||
private
|
private
|
||||||
$_message,
|
$_message,
|
||||||
|
|
@ -900,9 +899,7 @@ class GPG
|
||||||
|
|
||||||
private function _debug(string $msg) : void
|
private function _debug(string $msg) : void
|
||||||
{
|
{
|
||||||
if ($this->debug) {
|
\SnappyMail\Log::debug('GPG', $msg);
|
||||||
echo $msg . "\n";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private function setInput(&$input) : void
|
private function setInput(&$input) : void
|
||||||
|
|
@ -953,7 +950,7 @@ class GPG
|
||||||
private function exec(array $arguments) /*: array|false*/
|
private function exec(array $arguments) /*: array|false*/
|
||||||
{
|
{
|
||||||
if (\version_compare($this->version, '2.2.5', '<')) {
|
if (\version_compare($this->version, '2.2.5', '<')) {
|
||||||
// Too old (<2018)
|
\SnappyMail\Log::error('GPG', "{$this->version} too old");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1071,7 +1068,13 @@ class GPG
|
||||||
while (true) {
|
while (true) {
|
||||||
// Timeout after 5 seconds
|
// Timeout after 5 seconds
|
||||||
if (5 < \microtime(1) - $start) {
|
if (5 < \microtime(1) - $start) {
|
||||||
exit('timeout');
|
$errors[] = 'timeout';
|
||||||
|
return [
|
||||||
|
'output' => '',
|
||||||
|
'status' => $status,
|
||||||
|
'errors' => $errors
|
||||||
|
];
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$inputStreams = [];
|
$inputStreams = [];
|
||||||
|
|
@ -1257,7 +1260,7 @@ class GPG
|
||||||
$this->_debug('=> about to read ' . self::CHUNK_SIZE . ' bytes from GPG error');
|
$this->_debug('=> about to read ' . self::CHUNK_SIZE . ' bytes from GPG error');
|
||||||
foreach ($this->_openPipes->readPipeLines(self::FD_ERROR) as $line) {
|
foreach ($this->_openPipes->readPipeLines(self::FD_ERROR) as $line) {
|
||||||
$errors[] = $line;
|
$errors[] = $line;
|
||||||
$this->debug && $this->_debug("\t{$line}");
|
$this->_debug("\t{$line}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1271,7 +1274,7 @@ class GPG
|
||||||
if ('[GNUPG:] ' == \substr($line, 0, 9)) {
|
if ('[GNUPG:] ' == \substr($line, 0, 9)) {
|
||||||
$line = \substr($line, 9);
|
$line = \substr($line, 9);
|
||||||
$status[] = $line;
|
$status[] = $line;
|
||||||
$this->debug && $this->_debug("\t{$line}");
|
$this->_debug("\t{$line}");
|
||||||
|
|
||||||
$tokens = \explode(' ', $line);
|
$tokens = \explode(' ', $line);
|
||||||
// NEED_PASSPHRASE 0123456789ABCDEF 0123456789ABCDEF 1 0
|
// NEED_PASSPHRASE 0123456789ABCDEF 0123456789ABCDEF 1 0
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue