diff options
author | Faraz Samapoor <f.samapoor@gmail.com> | 2023-06-27 19:07:09 +0330 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-27 19:07:09 +0330 |
commit | bbfe2fb821f00713f46fd896a41dfc62cc02c31a (patch) | |
tree | 22923a6d3a78f7f1d780e958ff118a669c6c8c63 /apps/files_external/lib | |
parent | 8c64ccae01ef3143a47dcca0b7ddb115d601c2f1 (diff) | |
parent | 266436b76788d14e061bbe1f013bc052edc8041f (diff) | |
download | nextcloud-server-bbfe2fb821f00713f46fd896a41dfc62cc02c31a.tar.gz nextcloud-server-bbfe2fb821f00713f46fd896a41dfc62cc02c31a.zip |
Merge branch 'master' into replace_strpos_calls_in_dav_app
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
Diffstat (limited to 'apps/files_external/lib')
-rw-r--r-- | apps/files_external/lib/Command/Create.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/FtpConnection.php | 4 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/OwnCloud.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SFTP.php | 2 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/SMB.php | 8 | ||||
-rw-r--r-- | apps/files_external/lib/Lib/Storage/Swift.php | 5 |
6 files changed, 12 insertions, 11 deletions
diff --git a/apps/files_external/lib/Command/Create.php b/apps/files_external/lib/Command/Create.php index 17e4731a2d6..6208ac0da07 100644 --- a/apps/files_external/lib/Command/Create.php +++ b/apps/files_external/lib/Command/Create.php @@ -134,7 +134,7 @@ class Create extends Base { $config = []; foreach ($configInput as $configOption) { - if (!strpos($configOption, '=')) { + if (!str_contains($configOption, '=')) { $output->writeln('<error>Invalid mount configuration option "' . $configOption . '"</error>'); return 1; } diff --git a/apps/files_external/lib/Lib/Storage/FtpConnection.php b/apps/files_external/lib/Lib/Storage/FtpConnection.php index f183a5a52de..cca03ddda65 100644 --- a/apps/files_external/lib/Lib/Storage/FtpConnection.php +++ b/apps/files_external/lib/Lib/Storage/FtpConnection.php @@ -110,7 +110,7 @@ class FtpConnection { public function nlist(string $path) { $files = @ftp_nlist($this->connection, $path); return array_map(function ($name) { - if (strpos($name, '/') !== false) { + if (str_contains($name, '/')) { $name = basename($name); } return $name; @@ -122,7 +122,7 @@ class FtpConnection { if ($files !== false) { return array_map(function ($file) { - if (strpos($file['name'], '/') !== false) { + if (str_contains($file['name'], '/')) { $file['name'] = basename($file['name']); } return $file; diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php index d5926008f62..ba7ae1c36a9 100644 --- a/apps/files_external/lib/Lib/Storage/OwnCloud.php +++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php @@ -60,7 +60,7 @@ class OwnCloud extends \OC\Files\Storage\DAV implements IDisableEncryptionStorag $host = substr($host, 0, $hostSlashPos); } - if (substr($contextPath, -1) !== '/') { + if (!str_ends_with($contextPath, '/')) { $contextPath .= '/'; } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index e46f60d0be4..532c50808db 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -63,7 +63,7 @@ class SFTP extends \OC\Files\Storage\Common { */ private function splitHost($host) { $input = $host; - if (strpos($host, '://') === false) { + if (!str_contains($host, '://')) { // add a protocol to fix parse_url behavior with ipv6 $host = 'http://' . $host; } diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index e0e4659e668..66319d66770 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -139,13 +139,13 @@ class SMB extends Common implements INotifyStorage { } private function splitUser($user) { - if (strpos($user, '/')) { + if (str_contains($user, '/')) { return explode('/', $user, 2); - } elseif (strpos($user, '\\')) { + } elseif (str_contains($user, '\\')) { return explode('\\', $user); - } else { - return [null, $user]; } + + return [null, $user]; } /** diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index 85b3727f4db..26e6c5315cb 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -126,9 +126,10 @@ class Swift extends \OC\Files\Storage\Common { * @throws \OCP\Files\StorageNotAvailableException */ private function fetchObject(string $path) { - if ($this->objectCache->hasKey($path)) { + $cached = $this->objectCache->get($path); + if ($cached !== null) { // might be "false" if object did not exist from last check - return $this->objectCache->get($path); + return $cached; } try { $object = $this->getContainer()->getObject($path); |