mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-02-03 12:28:30 +00:00
Merge branch '1.0' into 2.0
This commit is contained in:
commit
82406869fb
@ -259,6 +259,16 @@ class SFTP extends SSH2
|
|||||||
*/
|
*/
|
||||||
var $requestBuffer = array();
|
var $requestBuffer = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Preserve timestamps on file downloads / uploads
|
||||||
|
*
|
||||||
|
* @see self::get()
|
||||||
|
* @see self::put()
|
||||||
|
* @var bool
|
||||||
|
* @access private
|
||||||
|
*/
|
||||||
|
var $preserveTime = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor.
|
* Default Constructor.
|
||||||
*
|
*
|
||||||
@ -2075,6 +2085,11 @@ class SFTP extends SSH2
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($mode & self::SOURCE_LOCAL_FILE) {
|
if ($mode & self::SOURCE_LOCAL_FILE) {
|
||||||
|
if ($this->preserveTime) {
|
||||||
|
$stat = fstat($fp);
|
||||||
|
$this->touch($remote_file, $stat['mtime'], $stat['atime']);
|
||||||
|
}
|
||||||
|
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2292,6 +2307,11 @@ class SFTP extends SSH2
|
|||||||
|
|
||||||
if ($fclose_check) {
|
if ($fclose_check) {
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
|
|
||||||
|
if ($this->preserveTime) {
|
||||||
|
$stat = $this->stat($remote_file);
|
||||||
|
touch($local_file, $stat['mtime'], $stat['atime']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->_close_handle($handle)) {
|
if (!$this->_close_handle($handle)) {
|
||||||
@ -3176,4 +3196,24 @@ class SFTP extends SSH2
|
|||||||
$this->pwd = false;
|
$this->pwd = false;
|
||||||
parent::_disconnect($reason);
|
parent::_disconnect($reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable Date Preservation
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function enableDatePreservation()
|
||||||
|
{
|
||||||
|
$this->preserveTime = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disable Date Preservation
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
function disableDatePreservation()
|
||||||
|
{
|
||||||
|
$this->preserveTime = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user