Implemented IShare::append(), leave ::write() due backwards compatibility

This commit is contained in:
Robin Appelman 2018-08-28 16:21:15 +02:00
commit 59519bad2c
5 changed files with 79 additions and 5 deletions

View file

@ -109,6 +109,12 @@ class NativeShare extends AbstractShare {
return new NativeFileInfo($this, $path, basename($path), $this->getStat($path));
}
/**
* Get fstat
*
* @param string $path
* @return array
*/
public function getStat($path) {
return $this->getState()->stat($this->buildUrl($path));
}
@ -228,7 +234,7 @@ class NativeShare extends AbstractShare {
}
/**
* Open a readable stream top a remote file
* Open a readable stream to a remote file
*
* @param string $source
* @return resource a read only stream with the contents of the remote file
@ -243,10 +249,11 @@ class NativeShare extends AbstractShare {
}
/**
* Open a readable stream top a remote file
* Open a writeable stream to a remote file
* Note: This method will truncate the file to 0bytes first
*
* @param string $source
* @return resource a read only stream with the contents of the remote file
* @return resource a writeable stream
*
* @throws \Icewind\SMB\Exception\NotFoundException
* @throws \Icewind\SMB\Exception\InvalidTypeException
@ -257,6 +264,21 @@ class NativeShare extends AbstractShare {
return NativeWriteStream::wrap($this->getState(), $handle, 'w', $url);
}
/**
* Open a writeable stream and set the cursor to the end of the stream
*
* @param string $source
* @return resource a writeable stream
*
* @throws \Icewind\SMB\Exception\NotFoundException
* @throws \Icewind\SMB\Exception\InvalidTypeException
*/
public function append($source) {
$url = $this->buildUrl($source);
$handle = $this->getState()->open($url, "a");
return NativeWriteStream::wrap($this->getState(), $handle, "a", $url);
}
/**
* Get extended attributes for the path
*
@ -269,7 +291,7 @@ class NativeShare extends AbstractShare {
}
/**
* Get extended attributes for the path
* Set extended attributes for the given path
*
* @param string $path
* @param string $attribute attribute to get the info
@ -285,6 +307,8 @@ class NativeShare extends AbstractShare {
}
/**
* Set DOS comaptible node mode
*
* @param string $path
* @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL
* @return mixed
@ -294,6 +318,9 @@ class NativeShare extends AbstractShare {
}
/**
* Start smb notify listener
* Note: This is a blocking call
*
* @param string $path
* @return INotifyHandler
*/