chore(user_ldap): Move static var to static property and silence warning

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
This commit is contained in:
Côme Chilliet 2026-05-11 18:44:26 +02:00
parent 54be8ca769
commit 68f417b354
No known key found for this signature in database
GPG key ID: A3E2F658B28C760A

View file

@ -139,6 +139,9 @@ class Connection extends LDAPUtility {
protected LoggerInterface $logger;
private IL10N $l10n;
/** @psalm-suppress ImpureStaticProperty This is a cache for whether php-ldap is installed, which cannot change mid-process */
private static bool $phpLDAPinstalled = true;
/**
* Constructor
* @param string $configPrefix a string with the prefix for the configkey column (appconfig table)
@ -589,8 +592,7 @@ class Connection extends LDAPUtility {
if (!$this->configuration->ldapConfigurationActive) {
return null;
}
static $phpLDAPinstalled = true;
if (!$phpLDAPinstalled) {
if (!static::$phpLDAPinstalled) {
return false;
}
if (!$this->ignoreValidation && !$this->configured) {
@ -602,7 +604,7 @@ class Connection extends LDAPUtility {
}
if (!$this->ldapConnectionRes) {
if (!$this->ldap->areLDAPFunctionsAvailable()) {
$phpLDAPinstalled = false;
static::$phpLDAPinstalled = false;
$this->logger->error(
'function ldap_connect is not available. Make sure that the PHP ldap module is installed.',
['app' => 'user_ldap']