aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDaniel <mail@danielkesselberg.de>2023-07-24 12:52:21 +0200
committerGitHub <noreply@github.com>2023-07-24 12:52:21 +0200
commit0411cc64aaaaa42ae23b4d5e216f16d481f20819 (patch)
treeded35397cd0d2446358111ffb1b0cb7ef707c373 /apps
parentbef40531f0820b8ba1869524b3a9830a10413b1b (diff)
parent8778f2912f259a5eef7e4ec6a09a38e9748c1b70 (diff)
downloadnextcloud-server-0411cc64aaaaa42ae23b4d5e216f16d481f20819.tar.gz
nextcloud-server-0411cc64aaaaa42ae23b4d5e216f16d481f20819.zip
Merge pull request #38606 from fsamapoor/replace_strpos_calls_in_settings_app
Refactors "strpos" calls in /apps/settings
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/lib/Controller/CheckSetupController.php6
-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, 7 insertions, 7 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php
index f1d3c8ae8b2..07fb627dbd8 100644
--- a/apps/settings/lib/Controller/CheckSetupController.php
+++ b/apps/settings/lib/Controller/CheckSetupController.php
@@ -300,7 +300,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/');
@@ -391,7 +391,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;
}
@@ -592,7 +592,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;