Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix Dirmask::copy/rename parameter naming
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Feb 9, 2023
commit df37219dafc5d5aae069622de30131b0623e1e8e
28 changes: 14 additions & 14 deletions lib/Storage/DirMask.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,41 +100,41 @@ public function getPermissions($path): int {
}
}

public function rename($path1, $path2): bool {
if (!$this->isUpdatable($path1)) {
public function rename($source, $target): bool {
if (!$this->isUpdatable($source)) {
return false;
}
if ($this->file_exists($path2)) {
if ($this->isUpdatable($path2)) {
return $this->storage->rename($path1, $path2);
if ($this->file_exists($target)) {
if ($this->isUpdatable($target)) {
return $this->storage->rename($source, $target);
}
} else {
$parent = dirname($path2);
$parent = dirname($target);
if ($parent === '.') {
$parent = '';
}
if ($this->isCreatable($parent)) {
return $this->storage->rename($path1, $path2);
return $this->storage->rename($source, $target);
}
}
return false;
}

public function copy($path1, $path2): bool {
if (!$this->isReadable($path1)) {
public function copy($source, $target): bool {
if (!$this->isReadable($source)) {
return false;
}
if ($this->file_exists($path2)) {
if ($this->isUpdatable($path2)) {
return $this->storage->copy($path1, $path2);
if ($this->file_exists($target)) {
if ($this->isUpdatable($target)) {
return $this->storage->copy($source, $target);
}
} else {
$parent = dirname($path2);
$parent = dirname($target);
if ($parent === '.') {
$parent = '';
}
if ($this->isCreatable($parent)) {
return $this->storage->copy($path1, $path2);
return $this->storage->copy($source, $target);
}
}
return false;
Expand Down