mirror of
https://codeberg.org/icewind/SMB.git
synced 2026-06-03 09:14:06 +02:00
type fixes
This commit is contained in:
parent
e9f6d00a93
commit
7cb4e41f8a
7 changed files with 32 additions and 7 deletions
|
|
@ -316,8 +316,12 @@ class NativeShare extends AbstractShare {
|
|||
* @return mixed the attribute value
|
||||
*/
|
||||
public function setAttribute(string $path, string $attribute, $value) {
|
||||
if ($attribute === 'system.dos_attr.mode' and is_int($value)) {
|
||||
$value = '0x' . dechex($value);
|
||||
if (is_int($value)) {
|
||||
if ($attribute === 'system.dos_attr.mode') {
|
||||
$value = '0x' . dechex($value);
|
||||
} else {
|
||||
throw new \InvalidArgumentException("Invalid value for attribute");
|
||||
}
|
||||
}
|
||||
|
||||
return $this->getState()->setxattr($this->buildUrl($path), $attribute, $value);
|
||||
|
|
|
|||
|
|
@ -247,7 +247,7 @@ class NativeState {
|
|||
* @param int $offset
|
||||
* @param int $whence SEEK_SET | SEEK_CUR | SEEK_END
|
||||
* @param string|null $path
|
||||
* @return int|bool new file offset as measured from the start of the file on success, false on failure.
|
||||
* @return int new file offset as measured from the start of the file on success.
|
||||
*/
|
||||
public function lseek($file, int $offset, int $whence = SEEK_SET, string $path = null) {
|
||||
$result = @smbclient_lseek($this->state, $file, $offset, $whence);
|
||||
|
|
|
|||
|
|
@ -165,7 +165,7 @@ class Parser {
|
|||
$mode = $this->parseMode($mode);
|
||||
$time = strtotime($time . ' ' . $this->timeZone);
|
||||
$path = $basePath . '/' . $name;
|
||||
$content[] = new FileInfo($path, $name, $size, $time, $mode, function () use ($aclCallback, $path) {
|
||||
$content[] = new FileInfo($path, $name, (int)$size, $time, $mode, function () use ($aclCallback, $path) {
|
||||
return $aclCallback($path);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ class RawConnection {
|
|||
public function isValid(): bool {
|
||||
if (is_resource($this->process)) {
|
||||
$status = proc_get_status($this->process);
|
||||
return $status['running'];
|
||||
return (bool)$status['running'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -355,9 +355,14 @@ class Share extends AbstractShare {
|
|||
|
||||
// use a close callback to ensure the upload is finished before continuing
|
||||
// this also serves as a way to keep the connection in scope
|
||||
return CallbackWrapper::wrap($fh, null, null, function () use ($connection) {
|
||||
$stream = CallbackWrapper::wrap($fh, null, null, function () use ($connection) {
|
||||
$connection->close(false); // dont terminate, give the upload some time
|
||||
});
|
||||
if (is_resource($stream)) {
|
||||
return $stream;
|
||||
} else {
|
||||
throw new InvalidRequestException($target);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue