mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
Add more tests for stream
This commit is contained in:
parent
2e8af98252
commit
7035de036c
2 changed files with 117 additions and 9 deletions
|
|
@ -303,19 +303,27 @@ class NativeShare implements IShare {
|
|||
return fopen('nativesmb://dummy', 'r', false, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open a readable stream top a remote file
|
||||
*
|
||||
* @param string $source
|
||||
* @return resource a read only stream with the contents of the remote file
|
||||
*/
|
||||
public function write($source) {
|
||||
$handle = $this->create($source);
|
||||
$context = stream_context_create(array(
|
||||
'nativesmb' => array(
|
||||
'state' => $this->state,
|
||||
'handle' => $handle
|
||||
)
|
||||
));
|
||||
return fopen('nativesmb://dummy', 'w', false, $context);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Server
|
||||
*/
|
||||
public function getServer() {
|
||||
return $this->server;
|
||||
}
|
||||
|
||||
public function __destruct() {
|
||||
if ($this->state and is_resource($this->state)) {
|
||||
self::registerErrorHandler();
|
||||
smbclient_state_free($this->state);
|
||||
restore_error_handler();
|
||||
}
|
||||
unset($this->state);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue