Skip to content

Commit

Permalink
Merge pull request #368 from nextcloud/fix/storage-api
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusknorr authored Oct 17, 2024
2 parents b0f37d6 + 5218fed commit 72d27cf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/Storage/LockWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected function isLocked(string $ownerId, string $path, string $viewerId, &$l
}


public function rename($path1, $path2) {
public function rename($path1, $path2): bool {
if (strpos($path1, $path2) === 0) {
$part = substr($path1, strlen($path2));
//This is a rename of the transfer file to the original file
Expand All @@ -149,7 +149,7 @@ public function rename($path1, $path2) {
&& parent::rename($path1, $path2);
}

public function copy($path1, $path2) {
public function copy($path1, $path2): bool {
$permissions =
$this->file_exists($path2) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;

Expand All @@ -160,28 +160,28 @@ public function copy($path1, $path2) {
&& parent::copy($path1, $path2);
}

public function touch($path, $mtime = null) {
public function touch($path, $mtime = null): bool {
$permissions =
$this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;

return $this->checkPermissions($path, $permissions) && parent::touch($path, $mtime);
}

public function mkdir($path) {
public function mkdir($path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_CREATE) && parent::mkdir($path);
}

public function rmdir($path) {
public function rmdir($path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_DELETE)
&& parent::rmdir($path);
}

public function unlink($path) {
public function unlink($path): bool {
return $this->checkPermissions($path, Constants::PERMISSION_DELETE)
&& parent::unlink($path);
}

public function file_put_contents($path, $data) {
public function file_put_contents($path, $data): int|float|false {
$permissions =
$this->file_exists($path) ? Constants::PERMISSION_UPDATE : Constants::PERMISSION_CREATE;

Expand All @@ -206,7 +206,7 @@ public function writeStream(string $path, $stream, ?int $size = null): int {
return $this->checkPermissions($path, $permissions) ? parent::writeStream($path, $stream, $size) : 0;
}

public function file_get_contents($path) {
public function file_get_contents($path): string|false {
if (!$this->checkPermissions($path, Constants::PERMISSION_READ)) {
return false;
}
Expand Down

0 comments on commit 72d27cf

Please sign in to comment.