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
|
* 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
|
* @param string $target
|
||||||
* @return resource a write only stream to upload a remote file
|
* @return resource a write only stream to upload a remote file
|
||||||
|
|
@ -62,7 +62,7 @@ interface IShare {
|
||||||
*/
|
*/
|
||||||
public function write($target);
|
public function write($target);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a writable stream to a remote file and set the cursor to the end of the file
|
* Open a writable stream to a remote file and set the cursor to the end of the file
|
||||||
*
|
*
|
||||||
* @param string $target
|
* @param string $target
|
||||||
|
|
|
||||||
|
|
@ -109,12 +109,12 @@ class NativeShare extends AbstractShare {
|
||||||
return new NativeFileInfo($this, $path, basename($path), $this->getStat($path));
|
return new NativeFileInfo($this, $path, basename($path), $this->getStat($path));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get fstat
|
* Get fstat
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getStat($path) {
|
public function getStat($path) {
|
||||||
return $this->getState()->stat($this->buildUrl($path));
|
return $this->getState()->stat($this->buildUrl($path));
|
||||||
}
|
}
|
||||||
|
|
@ -250,7 +250,7 @@ class NativeShare extends AbstractShare {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a writeable stream to a remote file
|
* 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
|
* @param string $source
|
||||||
* @return resource a writeable stream
|
* @return resource a writeable stream
|
||||||
|
|
@ -264,20 +264,20 @@ class NativeShare extends AbstractShare {
|
||||||
return NativeWriteStream::wrap($this->getState(), $handle, 'w', $url);
|
return NativeWriteStream::wrap($this->getState(), $handle, 'w', $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Open a writeable stream and set the cursor to the end of the stream
|
* Open a writeable stream and set the cursor to the end of the stream
|
||||||
*
|
*
|
||||||
* @param string $source
|
* @param string $source
|
||||||
* @return resource a writeable stream
|
* @return resource a writeable stream
|
||||||
*
|
*
|
||||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||||
*/
|
*/
|
||||||
public function append($source) {
|
public function append($source) {
|
||||||
$url = $this->buildUrl($source);
|
$url = $this->buildUrl($source);
|
||||||
$handle = $this->getState()->open($url, "a");
|
$handle = $this->getState()->open($url, "a");
|
||||||
return NativeWriteStream::wrap($this->getState(), $handle, "a", $url);
|
return NativeWriteStream::wrap($this->getState(), $handle, "a", $url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get extended attributes for the path
|
* 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 string $path
|
||||||
* @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL
|
* @param int $mode a combination of FileInfo::MODE_READONLY, FileInfo::MODE_ARCHIVE, FileInfo::MODE_SYSTEM and FileInfo::MODE_HIDDEN, FileInfo::NORMAL
|
||||||
* @return mixed
|
* @return mixed
|
||||||
|
|
@ -318,9 +318,9 @@ class NativeShare extends AbstractShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start smb notify listener
|
* Start smb notify listener
|
||||||
* Note: This is a blocking call
|
* Note: This is a blocking call
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return INotifyHandler
|
* @return INotifyHandler
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -345,24 +345,24 @@ class Share extends AbstractShare {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append to stream
|
* Append to stream
|
||||||
* Note: smbclient does not support it so we use php-libsmbclient
|
* Note: smbclient does not support it so we use php-libsmbclient
|
||||||
*
|
*
|
||||||
* @param string $target
|
* @param string $target
|
||||||
*
|
*
|
||||||
* @throws \Icewind\SMB\Exception\DependencyException
|
* @throws \Icewind\SMB\Exception\DependencyException
|
||||||
* @throws \Icewind\SMB\Exception\NotFoundException
|
* @throws \Icewind\SMB\Exception\NotFoundException
|
||||||
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
* @throws \Icewind\SMB\Exception\InvalidTypeException
|
||||||
*/
|
*/
|
||||||
public function append($target) {
|
public function append($target) {
|
||||||
if (!NativeServer::available($this->server->getSystem())) {
|
if (!NativeServer::available($this->server->getSystem())) {
|
||||||
throw new DependencyException('php-libsmbclient not installed');
|
throw new DependencyException('php-libsmbclient not installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
$share = new NativeShare($this->server, $this->getName());
|
$share = new NativeShare($this->server, $this->getName());
|
||||||
return $share->append($target);
|
return $share->append($target);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $path
|
* @param string $path
|
||||||
|
|
|
||||||
|
|
@ -474,20 +474,20 @@ abstract class AbstractShareTest extends TestCase {
|
||||||
unlink($tmpFile1);
|
unlink($tmpFile1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAppendStream() {
|
public function testAppendStream() {
|
||||||
$fh = $this->share->append($this->root . '/' . $name);
|
$fh = $this->share->append($this->root . '/' . $name);
|
||||||
fwrite($fh, 'foo');
|
fwrite($fh, 'foo');
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
|
|
||||||
$fh = $this->share->append($this->root . '/' . $name);
|
$fh = $this->share->append($this->root . '/' . $name);
|
||||||
fwrite($fh, 'bar');
|
fwrite($fh, 'bar');
|
||||||
fclose($fh);
|
fclose($fh);
|
||||||
|
|
||||||
$tmpFile1 = tempnam('/tmp', 'smb_test_');
|
$tmpFile1 = tempnam('/tmp', 'smb_test_');
|
||||||
$this->assertEquals('foobar', file_get_contents($tmpFile1));
|
$this->assertEquals('foobar', file_get_contents($tmpFile1));
|
||||||
$this->share->del($this->root . '/' . $name);
|
$this->share->del($this->root . '/' . $name);
|
||||||
unlink($tmpFile1);
|
unlink($tmpFile1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @dataProvider invalidPathProvider
|
* @dataProvider invalidPathProvider
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ use Icewind\SMB\System;
|
||||||
use Icewind\SMB\TimeZoneProvider;
|
use Icewind\SMB\TimeZoneProvider;
|
||||||
|
|
||||||
class NativeShareTest extends AbstractShareTest {
|
class NativeShareTest extends AbstractShareTest {
|
||||||
public function setUp() {
|
public function setUp() {
|
||||||
$this->requireBackendEnv('libsmbclient');
|
$this->requireBackendEnv('libsmbclient');
|
||||||
if (!function_exists('smbclient_state_new')) {
|
if (!function_exists('smbclient_state_new')) {
|
||||||
$this->markTestSkipped('libsmbclient php extension not installed');
|
$this->markTestSkipped('libsmbclient php extension not installed');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue