mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 17:24:07 +02:00
spaces to tab fix
This commit is contained in:
parent
1cb1f3f56a
commit
99f721a436
5 changed files with 60 additions and 60 deletions
|
|
@ -52,7 +52,7 @@ interface IShare {
|
|||
|
||||
/**
|
||||
* Open a writable stream to a remote file
|
||||
* Note: This method will truncate the file to 0bytes
|
||||
* Note: This method will truncate the file to 0bytes
|
||||
*
|
||||
* @param string $target
|
||||
* @return resource a write only stream to upload a remote file
|
||||
|
|
@ -62,7 +62,7 @@ interface IShare {
|
|||
*/
|
||||
public function write($target);
|
||||
|
||||
/**
|
||||
/**
|
||||
* Open a writable stream to a remote file and set the cursor to the end of the file
|
||||
*
|
||||
* @param string $target
|
||||
|
|
|
|||
|
|
@ -109,12 +109,12 @@ class NativeShare extends AbstractShare {
|
|||
return new NativeFileInfo($this, $path, basename($path), $this->getStat($path));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get fstat
|
||||
*
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* Get fstat
|
||||
*
|
||||
* @param string $path
|
||||
* @return array
|
||||
*/
|
||||
public function getStat($path) {
|
||||
return $this->getState()->stat($this->buildUrl($path));
|
||||
}
|
||||
|
|
@ -250,7 +250,7 @@ class NativeShare extends AbstractShare {
|
|||
|
||||
/**
|
||||
* Open a writeable stream to a remote file
|
||||
* Note: This method will truncate the file to 0bytes first
|
||||
* Note: This method will truncate the file to 0bytes first
|
||||
*
|
||||
* @param string $source
|
||||
* @return resource a writeable stream
|
||||
|
|
@ -264,20 +264,20 @@ 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);
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
|
|
@ -307,8 +307,8 @@ class NativeShare extends AbstractShare {
|
|||
}
|
||||
|
||||
/**
|
||||
* Set DOS comaptible node mode
|
||||
*
|
||||
* 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
|
||||
|
|
@ -318,9 +318,9 @@ class NativeShare extends AbstractShare {
|
|||
}
|
||||
|
||||
/**
|
||||
* Start smb notify listener
|
||||
* Note: This is a blocking call
|
||||
*
|
||||
* Start smb notify listener
|
||||
* Note: This is a blocking call
|
||||
*
|
||||
* @param string $path
|
||||
* @return INotifyHandler
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -345,24 +345,24 @@ class Share extends AbstractShare {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Append to stream
|
||||
* Note: smbclient does not support it so we use php-libsmbclient
|
||||
*
|
||||
* @param string $target
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\DependencyException
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
/**
|
||||
* Append to stream
|
||||
* Note: smbclient does not support it so we use php-libsmbclient
|
||||
*
|
||||
* @param string $target
|
||||
*
|
||||
* @throws \Icewind\SMB\Exception\DependencyException
|
||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||
*/
|
||||
public function append($target) {
|
||||
if (!NativeServer::available($this->server->getSystem())) {
|
||||
throw new DependencyException('php-libsmbclient not installed');
|
||||
}
|
||||
public function append($target) {
|
||||
if (!NativeServer::available($this->server->getSystem())) {
|
||||
throw new DependencyException('php-libsmbclient not installed');
|
||||
}
|
||||
|
||||
$share = new NativeShare($this->server, $this->getName());
|
||||
return $share->append($target);
|
||||
}
|
||||
$share = new NativeShare($this->server, $this->getName());
|
||||
return $share->append($target);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $path
|
||||
|
|
|
|||
|
|
@ -474,20 +474,20 @@ abstract class AbstractShareTest extends TestCase {
|
|||
unlink($tmpFile1);
|
||||
}
|
||||
|
||||
public function testAppendStream() {
|
||||
$fh = $this->share->append($this->root . '/' . $name);
|
||||
fwrite($fh, 'foo');
|
||||
fclose($fh);
|
||||
public function testAppendStream() {
|
||||
$fh = $this->share->append($this->root . '/' . $name);
|
||||
fwrite($fh, 'foo');
|
||||
fclose($fh);
|
||||
|
||||
$fh = $this->share->append($this->root . '/' . $name);
|
||||
fwrite($fh, 'bar');
|
||||
fclose($fh);
|
||||
$fh = $this->share->append($this->root . '/' . $name);
|
||||
fwrite($fh, 'bar');
|
||||
fclose($fh);
|
||||
|
||||
$tmpFile1 = tempnam('/tmp', 'smb_test_');
|
||||
$this->assertEquals('foobar', file_get_contents($tmpFile1));
|
||||
$this->share->del($this->root . '/' . $name);
|
||||
unlink($tmpFile1);
|
||||
}
|
||||
$tmpFile1 = tempnam('/tmp', 'smb_test_');
|
||||
$this->assertEquals('foobar', file_get_contents($tmpFile1));
|
||||
$this->share->del($this->root . '/' . $name);
|
||||
unlink($tmpFile1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider invalidPathProvider
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ use Icewind\SMB\System;
|
|||
use Icewind\SMB\TimeZoneProvider;
|
||||
|
||||
class NativeShareTest extends AbstractShareTest {
|
||||
public function setUp() {
|
||||
public function setUp() {
|
||||
$this->requireBackendEnv('libsmbclient');
|
||||
if (!function_exists('smbclient_state_new')) {
|
||||
$this->markTestSkipped('libsmbclient php extension not installed');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue