mirror of
https://github.com/danog/phpseclib.git
synced 2024-12-14 10:07:32 +01:00
Merge branch '3.0'
This commit is contained in:
commit
096251d645
@ -263,6 +263,16 @@ class SFTP extends SSH2
|
||||
*/
|
||||
var $requestBuffer = array();
|
||||
|
||||
/**
|
||||
* Preserve timestamps on file downloads / uploads
|
||||
*
|
||||
* @see self::get()
|
||||
* @see self::put()
|
||||
* @var bool
|
||||
* @access private
|
||||
*/
|
||||
var $preserveTime = false;
|
||||
|
||||
/**
|
||||
* Default Constructor.
|
||||
*
|
||||
@ -1991,6 +2001,11 @@ class SFTP extends SSH2
|
||||
}
|
||||
|
||||
if ($mode & self::SOURCE_LOCAL_FILE) {
|
||||
if ($this->preserveTime) {
|
||||
$stat = fstat($fp);
|
||||
$this->touch($remote_file, $stat['mtime'], $stat['atime']);
|
||||
}
|
||||
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
@ -2206,6 +2221,11 @@ class SFTP extends SSH2
|
||||
|
||||
if ($fclose_check) {
|
||||
fclose($fp);
|
||||
|
||||
if ($this->preserveTime) {
|
||||
$stat = $this->stat($remote_file);
|
||||
touch($local_file, $stat['mtime'], $stat['atime']);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->close_handle($handle)) {
|
||||
@ -3055,4 +3075,24 @@ class SFTP extends SSH2
|
||||
$this->pwd = false;
|
||||
parent::disconnect_helper($reason);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable Date Preservation
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function enableDatePreservation()
|
||||
{
|
||||
$this->preserveTime = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable Date Preservation
|
||||
*
|
||||
* @access public
|
||||
*/
|
||||
function disableDatePreservation()
|
||||
{
|
||||
$this->preserveTime = false;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user