mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-16 02:07:09 +00:00
SFTP: fix logging constants
This commit is contained in:
parent
076c69fa1b
commit
b3171cc63f
@ -2705,13 +2705,13 @@ class SFTP extends SSH2
|
|||||||
if (defined('NET_SFTP_LOGGING')) {
|
if (defined('NET_SFTP_LOGGING')) {
|
||||||
$packet_type = '-> ' . $this->packet_types[$type] .
|
$packet_type = '-> ' . $this->packet_types[$type] .
|
||||||
' (' . round($stop - $start, 4) . 's)';
|
' (' . round($stop - $start, 4) . 's)';
|
||||||
if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) {
|
if (NET_SFTP_LOGGING == self::LOG_REALTIME) {
|
||||||
echo "<pre>\r\n" . $this->_format_log(array($data), array($packet_type)) . "\r\n</pre>\r\n";
|
echo "<pre>\r\n" . $this->_format_log(array($data), array($packet_type)) . "\r\n</pre>\r\n";
|
||||||
flush();
|
flush();
|
||||||
ob_flush();
|
ob_flush();
|
||||||
} else {
|
} else {
|
||||||
$this->packet_type_log[] = $packet_type;
|
$this->packet_type_log[] = $packet_type;
|
||||||
if (NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX) {
|
if (NET_SFTP_LOGGING == self::LOG_COMPLEX) {
|
||||||
$this->packet_log[] = $data;
|
$this->packet_log[] = $data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2781,13 +2781,13 @@ class SFTP extends SSH2
|
|||||||
if (defined('NET_SFTP_LOGGING')) {
|
if (defined('NET_SFTP_LOGGING')) {
|
||||||
$packet_type = '<- ' . $this->packet_types[$this->packet_type] .
|
$packet_type = '<- ' . $this->packet_types[$this->packet_type] .
|
||||||
' (' . round($stop - $start, 4) . 's)';
|
' (' . round($stop - $start, 4) . 's)';
|
||||||
if (NET_SFTP_LOGGING == NET_SFTP_LOG_REALTIME) {
|
if (NET_SFTP_LOGGING == self::LOG_REALTIME) {
|
||||||
echo "<pre>\r\n" . $this->_format_log(array($packet), array($packet_type)) . "\r\n</pre>\r\n";
|
echo "<pre>\r\n" . $this->_format_log(array($packet), array($packet_type)) . "\r\n</pre>\r\n";
|
||||||
flush();
|
flush();
|
||||||
ob_flush();
|
ob_flush();
|
||||||
} else {
|
} else {
|
||||||
$this->packet_type_log[] = $packet_type;
|
$this->packet_type_log[] = $packet_type;
|
||||||
if (NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX) {
|
if (NET_SFTP_LOGGING == self::LOG_COMPLEX) {
|
||||||
$this->packet_log[] = $packet;
|
$this->packet_log[] = $packet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2799,7 +2799,7 @@ class SFTP extends SSH2
|
|||||||
/**
|
/**
|
||||||
* Returns a log of the packets that have been sent and received.
|
* Returns a log of the packets that have been sent and received.
|
||||||
*
|
*
|
||||||
* Returns a string if NET_SFTP_LOGGING == NET_SFTP_LOG_COMPLEX, an array if NET_SFTP_LOGGING == NET_SFTP_LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING')
|
* Returns a string if NET_SFTP_LOGGING == self::LOG_COMPLEX, an array if NET_SFTP_LOGGING == self::LOG_SIMPLE and false if !defined('NET_SFTP_LOGGING')
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return string or Array
|
* @return string or Array
|
||||||
@ -2811,10 +2811,10 @@ class SFTP extends SSH2
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (NET_SFTP_LOGGING) {
|
switch (NET_SFTP_LOGGING) {
|
||||||
case NET_SFTP_LOG_COMPLEX:
|
case self::LOG_COMPLEX:
|
||||||
return $this->_format_log($this->packet_log, $this->packet_type_log);
|
return $this->_format_log($this->packet_log, $this->packet_type_log);
|
||||||
break;
|
break;
|
||||||
//case NET_SFTP_LOG_SIMPLE:
|
//case self::LOG_SIMPLE:
|
||||||
default:
|
default:
|
||||||
return $this->packet_type_log;
|
return $this->packet_type_log;
|
||||||
}
|
}
|
||||||
|
@ -3488,14 +3488,14 @@ class SSH2
|
|||||||
@flush();
|
@flush();
|
||||||
@ob_flush();
|
@ob_flush();
|
||||||
break;
|
break;
|
||||||
// basically the same thing as self::LOG_REALTIME with the caveat that self::LOG_REALTIME_FILE
|
// basically the same thing as self::LOG_REALTIME with the caveat that NET_SFTP_LOG_REALTIME_FILENAME
|
||||||
// needs to be defined and that the resultant log file will be capped out at self::LOG_MAX_SIZE.
|
// needs to be defined and that the resultant log file will be capped out at self::LOG_MAX_SIZE.
|
||||||
// the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily
|
// the earliest part of the log file is denoted by the first <<< START >>> and is not going to necessarily
|
||||||
// at the beginning of the file
|
// at the beginning of the file
|
||||||
case self::LOG_REALTIME_FILE:
|
case self::LOG_REALTIME_FILE:
|
||||||
if (!isset($this->realtime_log_file)) {
|
if (!isset($this->realtime_log_file)) {
|
||||||
// PHP doesn't seem to like using constants in fopen()
|
// PHP doesn't seem to like using constants in fopen()
|
||||||
$filename = self::LOG_REALTIME_FILENAME;
|
$filename = NET_SSH2_LOG_REALTIME_FILENAME;
|
||||||
$fp = fopen($filename, 'w');
|
$fp = fopen($filename, 'w');
|
||||||
$this->realtime_log_file = $fp;
|
$this->realtime_log_file = $fp;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user