aboutsummaryrefslogtreecommitdiffstats
path: root/apps/settings
diff options
context:
space:
mode:
authorFaraz Samapoor <f.samapoor@gmail.com>2023-06-02 14:33:10 +0330
committerCôme Chilliet <91878298+come-nc@users.noreply.github.com>2023-06-05 14:39:40 +0200
commitff0b3feb2ed58da2af7fd53d741d2f4b2581af58 (patch)
treeafb75b3694db7f7935711287ae9dd383cf7e4aa6 /apps/settings
parent91686e014e8da3f8eecfe5a6a513e8f2c7b3ee76 (diff)
downloadnextcloud-server-ff0b3feb2ed58da2af7fd53d741d2f4b2581af58.tar.gz
nextcloud-server-ff0b3feb2ed58da2af7fd53d741d2f4b2581af58.zip
Refactors "strpos" calls in /apps/settings to improve code readability.
Signed-off-by: Faraz Samapoor <f.samapoor@gmail.com>
Diffstat (limited to 'apps/settings')
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php8
-rw-r--r--apps/settings/lib/Search/AppSearch.php2
-rw-r--r--apps/settings/lib/Settings/Personal/PersonalInfo.php4
-rw-r--r--apps/settings/lib/SetupChecks/SupportedDatabase.php2
4 files changed, 8 insertions, 8 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index be0abe0d75c..2aceeae1016 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -291,7 +291,7 @@ class CheckSetupController extends Controller {
}
// Check if at least OpenSSL after 1.01d or 1.0.2b
- if (strpos($versionString, 'OpenSSL/') === 0) {
+ if (str_starts_with($versionString, 'OpenSSL/')) {
$majorVersion = substr($versionString, 8, 5);
$patchRelease = substr($versionString, 13, 6);
@@ -302,7 +302,7 @@ class CheckSetupController extends Controller {
}
// Check if NSS and perform heuristic check
- if (strpos($versionString, 'NSS/') === 0) {
+ if (str_starts_with($versionString, 'NSS/')) {
try {
$firstClient = $this->clientService->newClient();
$firstClient->get('https://nextcloud.com/');
@@ -393,7 +393,7 @@ class CheckSetupController extends Controller {
*/
private function isSettimelimitAvailable() {
if (function_exists('set_time_limit')
- && strpos(ini_get('disable_functions'), 'set_time_limit') === false) {
+ && !str_contains(ini_get('disable_functions'), 'set_time_limit')) {
return true;
}
@@ -577,7 +577,7 @@ Raw output
}
protected function isSqliteUsed() {
- return strpos($this->config->getSystemValue('dbtype'), 'sqlite') !== false;
+ return str_contains($this->config->getSystemValue('dbtype'), 'sqlite');
}
protected function isReadOnlyConfig(): bool {
diff --git a/apps/settings/lib/Search/AppSearch.php b/apps/settings/lib/Search/AppSearch.php
index fa3d884e80d..d4735f1c744 100644
--- a/apps/settings/lib/Search/AppSearch.php
+++ b/apps/settings/lib/Search/AppSearch.php
@@ -83,7 +83,7 @@ class AppSearch implements IProvider {
continue;
}
- if (strpos($query->getRoute(), $entry['id'] . '.') === 0) {
+ if (str_starts_with($query->getRoute(), $entry['id'] . '.')) {
// Skip the current app, unlikely this is intended
continue;
}
diff --git a/apps/settings/lib/Settings/Personal/PersonalInfo.php b/apps/settings/lib/Settings/Personal/PersonalInfo.php
index 535c1606527..9fbee6ef62f 100644
--- a/apps/settings/lib/Settings/Personal/PersonalInfo.php
+++ b/apps/settings/lib/Settings/Personal/PersonalInfo.php
@@ -333,8 +333,8 @@ class PersonalInfo implements ISettings {
$userLocale = reset($userLocale);
}
- $localesForLanguage = array_values(array_filter($localeCodes, fn ($localeCode) => strpos($localeCode['code'], $userLang) === 0));
- $otherLocales = array_values(array_filter($localeCodes, fn ($localeCode) => strpos($localeCode['code'], $userLang) !== 0));
+ $localesForLanguage = array_values(array_filter($localeCodes, fn ($localeCode) => str_starts_with($localeCode['code'], $userLang)));
+ $otherLocales = array_values(array_filter($localeCodes, fn ($localeCode) => !str_starts_with($localeCode['code'], $userLang)));
if (!$userLocale) {
$userLocale = [
diff --git a/apps/settings/lib/SetupChecks/SupportedDatabase.php b/apps/settings/lib/SetupChecks/SupportedDatabase.php
index 302797485d3..c925ad48043 100644
--- a/apps/settings/lib/SetupChecks/SupportedDatabase.php
+++ b/apps/settings/lib/SetupChecks/SupportedDatabase.php
@@ -68,7 +68,7 @@ class SupportedDatabase {
$row = $result->fetch();
$version = strtolower($row['Value']);
- if (strpos($version, 'mariadb') !== false) {
+ if (str_contains($version, 'mariadb')) {
if (version_compare($version, '10.2', '<')) {
$this->description = $this->l10n->t('MariaDB version "%s" is used. Nextcloud 21 and higher do not support this version and require MariaDB 10.2 or higher.', $row['Value']);
return;