aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_external
diff options
context:
space:
mode:
authorSimon L <szaimen@e.mail.de>2023-06-12 09:46:43 +0200
committerGitHub <noreply@github.com>2023-06-12 09:46:43 +0200
commitac57cf9f6b218105d1d473d152af93dd727c7032 (patch)
tree43fe40db2faec940c34bbe9faa826f38d7936642 /apps/files_external
parentc93be182dc0172eed377ba70ce54cd7c83689764 (diff)
parent94f2f575194e55ba932f9cb95c834ce2fe1ad506 (diff)
downloadnextcloud-server-ac57cf9f6b218105d1d473d152af93dd727c7032.tar.gz
nextcloud-server-ac57cf9f6b218105d1d473d152af93dd727c7032.zip
Merge pull request #38619 from fsamapoor/replace_strpos_calls_in_files_external_app
Refactors "strpos" calls in /apps/files_external
Diffstat (limited to 'apps/files_external')
-rw-r--r--apps/files_external/lib/Command/Create.php2
-rw-r--r--apps/files_external/lib/Lib/Storage/FtpConnection.php4
-rw-r--r--apps/files_external/lib/Lib/Storage/OwnCloud.php2
-rw-r--r--apps/files_external/lib/Lib/Storage/SFTP.php2
-rw-r--r--apps/files_external/lib/Lib/Storage/SMB.php8
5 files changed, 9 insertions, 9 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];
}
/**