Browse Source

Use argument name from parent class

This will be an issue with php 8, so best to fix it now

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
pull/34624/head
Carl Schwan 3 years ago
parent
commit
74e6976779
  1. 10
      apps/files_external/lib/Lib/Storage/SFTP.php
  2. 20
      apps/files_external/lib/Lib/Storage/SMB.php

10
apps/files_external/lib/Lib/Storage/SFTP.php

@ -435,14 +435,14 @@ class SFTP extends \OC\Files\Storage\Common {
/**
* {@inheritdoc}
*/
public function rename($source, $target) {
public function rename($path1, $path2) {
try {
if ($this->file_exists($target)) {
$this->unlink($target);
if ($this->file_exists($path2)) {
$this->unlink($path2);
}
return $this->getConnection()->rename(
$this->absPath($source),
$this->absPath($target)
$this->absPath($path1),
$this->absPath($path2)
);
} catch (\Exception $e) {
return false;

20
apps/files_external/lib/Lib/Storage/SMB.php

@ -306,31 +306,31 @@ class SMB extends Common implements INotifyStorage {
/**
* Rename the files. If the source or the target is the root, the rename won't happen.
*
* @param string $source the old name of the path
* @param string $target the new name of the path
* @param string $path1 the old name of the path
* @param string $path2 the new name of the path
* @return bool true if the rename is successful, false otherwise
*/
public function rename($source, $target, $retry = true) {
if ($this->isRootDir($source) || $this->isRootDir($target)) {
public function rename($path1, $path2, $retry = true) {
if ($this->isRootDir($path1) || $this->isRootDir($path2)) {
return false;
}
$absoluteSource = $this->buildPath($source);
$absoluteTarget = $this->buildPath($target);
$absoluteSource = $this->buildPath($path1);
$absoluteTarget = $this->buildPath($path2);
try {
$result = $this->share->rename($absoluteSource, $absoluteTarget);
} catch (AlreadyExistsException $e) {
if ($retry) {
$this->remove($target);
$result = $this->share->rename($absoluteSource, $absoluteTarget, false);
$this->remove($path2);
$result = $this->share->rename($absoluteSource, $absoluteTarget);
} else {
$this->logger->logException($e, ['level' => ILogger::WARN]);
return false;
}
} catch (InvalidArgumentException $e) {
if ($retry) {
$this->remove($target);
$result = $this->share->rename($absoluteSource, $absoluteTarget, false);
$this->remove($path2);
$result = $this->share->rename($absoluteSource, $absoluteTarget);
} else {
$this->logger->logException($e, ['level' => ILogger::WARN]);
return false;

Loading…
Cancel
Save