summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2022-10-25 10:20:09 +0200
committerCôme Chilliet <come.chilliet@nextcloud.com>2022-10-25 10:20:09 +0200
commit556e3c84e6c712e2974d6d35edb6abbdfe78dd9b (patch)
tree165617b1e2b83ee8d4a98ea4be2a70431f321472
parent4130a4cbd8e5bb4506ac30a19a91b088aa35dd24 (diff)
downloadnextcloud-server-556e3c84e6c712e2974d6d35edb6abbdfe78dd9b.tar.gz
nextcloud-server-556e3c84e6c712e2974d6d35edb6abbdfe78dd9b.zip
Fix return type for countUsers method
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
-rw-r--r--apps/user_ldap/lib/ILDAPUserPlugin.php3
-rw-r--r--apps/user_ldap/lib/UserPluginManager.php8
-rw-r--r--apps/user_ldap/lib/User_LDAP.php4
-rw-r--r--apps/user_ldap/lib/User_Proxy.php4
-rw-r--r--lib/private/User/Database.php20
-rw-r--r--lib/public/User/Backend/ICountUsersBackend.php3
6 files changed, 20 insertions, 22 deletions
diff --git a/apps/user_ldap/lib/ILDAPUserPlugin.php b/apps/user_ldap/lib/ILDAPUserPlugin.php
index 28754a7eaaf..06b86c50385 100644
--- a/apps/user_ldap/lib/ILDAPUserPlugin.php
+++ b/apps/user_ldap/lib/ILDAPUserPlugin.php
@@ -24,7 +24,6 @@
namespace OCA\User_LDAP;
interface ILDAPUserPlugin {
-
/**
* Check if plugin implements actions
* @return int
@@ -85,7 +84,7 @@ interface ILDAPUserPlugin {
/**
* Count the number of users
- * @return int|bool
+ * @return int|false
*/
public function countUsers();
}
diff --git a/apps/user_ldap/lib/UserPluginManager.php b/apps/user_ldap/lib/UserPluginManager.php
index 748a210cf60..516338f006b 100644
--- a/apps/user_ldap/lib/UserPluginManager.php
+++ b/apps/user_ldap/lib/UserPluginManager.php
@@ -65,7 +65,7 @@ class UserPluginManager {
\OC::$server->getLogger()->debug("Registered action ".$action." to plugin ".get_class($plugin), ['app' => 'user_ldap']);
}
}
- if (method_exists($plugin,'deleteUser')) {
+ if (method_exists($plugin, 'deleteUser')) {
$this->which['deleteUser'] = $plugin;
\OC::$server->getLogger()->debug("Registered action deleteUser to plugin ".get_class($plugin), ['app' => 'user_ldap']);
}
@@ -92,7 +92,7 @@ class UserPluginManager {
$plugin = $this->which[Backend::CREATE_USER];
if ($plugin) {
- return $plugin->createUser($username,$password);
+ return $plugin->createUser($username, $password);
}
throw new \Exception('No plugin implements createUser in this LDAP Backend.');
}
@@ -108,7 +108,7 @@ class UserPluginManager {
$plugin = $this->which[Backend::SET_PASSWORD];
if ($plugin) {
- return $plugin->setPassword($uid,$password);
+ return $plugin->setPassword($uid, $password);
}
throw new \Exception('No plugin implements setPassword in this LDAP Backend.');
}
@@ -176,7 +176,7 @@ class UserPluginManager {
/**
* Count the number of users
- * @return int|bool
+ * @return int|false
* @throws \Exception
*/
public function countUsers() {
diff --git a/apps/user_ldap/lib/User_LDAP.php b/apps/user_ldap/lib/User_LDAP.php
index 5a445100052..036ddaa9af4 100644
--- a/apps/user_ldap/lib/User_LDAP.php
+++ b/apps/user_ldap/lib/User_LDAP.php
@@ -45,10 +45,10 @@ use OCA\User_LDAP\Exceptions\NotOnLDAP;
use OCA\User_LDAP\User\OfflineUser;
use OCA\User_LDAP\User\User;
use OCP\IConfig;
+use OCP\IUserBackend;
use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
use OCP\User\Backend\ICountUsersBackend;
-use OCP\IUserBackend;
use OCP\UserInterface;
use Psr\Log\LoggerInterface;
@@ -581,7 +581,7 @@ class User_LDAP extends BackendUtility implements IUserBackend, UserInterface, I
/**
* counts the users in LDAP
*
- * @return int|bool
+ * @return int|false
*/
public function countUsers() {
if ($this->userPluginManager->implementsActions(Backend::COUNT_USERS)) {
diff --git a/apps/user_ldap/lib/User_Proxy.php b/apps/user_ldap/lib/User_Proxy.php
index 3e2d196e800..8b194f250b4 100644
--- a/apps/user_ldap/lib/User_Proxy.php
+++ b/apps/user_ldap/lib/User_Proxy.php
@@ -376,7 +376,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
/**
* Count the number of users
*
- * @return int|bool
+ * @return int|false
*/
public function countUsers() {
$this->setup();
@@ -385,7 +385,7 @@ class User_Proxy extends Proxy implements \OCP\IUserBackend, \OCP\UserInterface,
foreach ($this->backends as $backend) {
$backendUsers = $backend->countUsers();
if ($backendUsers !== false) {
- $users += $backendUsers;
+ $users = (int)$users + $backendUsers;
}
}
return $users;
diff --git a/lib/private/User/Database.php b/lib/private/User/Database.php
index f106c2e8b6d..8bbbccd4540 100644
--- a/lib/private/User/Database.php
+++ b/lib/private/User/Database.php
@@ -65,14 +65,14 @@ use OCP\User\Backend\ISetPasswordBackend;
*/
class Database extends ABackend implements
ICreateUserBackend,
- ISetPasswordBackend,
- ISetDisplayNameBackend,
- IGetDisplayNameBackend,
- ICheckPasswordBackend,
- IGetHomeBackend,
- ICountUsersBackend,
- ISearchKnownUsersBackend,
- IGetRealUIDBackend {
+ ISetPasswordBackend,
+ ISetDisplayNameBackend,
+ IGetDisplayNameBackend,
+ ICheckPasswordBackend,
+ IGetHomeBackend,
+ ICountUsersBackend,
+ ISearchKnownUsersBackend,
+ IGetRealUIDBackend {
/** @var CappedMemoryCache */
private $cache;
@@ -456,7 +456,7 @@ class Database extends ABackend implements
/**
* counts the users in the database
*
- * @return int|bool
+ * @return int|false
*/
public function countUsers() {
$this->fixDI();
@@ -464,7 +464,7 @@ class Database extends ABackend implements
$query = $this->dbConn->getQueryBuilder();
$query->select($query->func()->count('uid'))
->from($this->table);
- $result = $query->execute();
+ $result = $query->executeQuery();
return $result->fetchOne();
}
diff --git a/lib/public/User/Backend/ICountUsersBackend.php b/lib/public/User/Backend/ICountUsersBackend.php
index 52f947a654d..685de48d889 100644
--- a/lib/public/User/Backend/ICountUsersBackend.php
+++ b/lib/public/User/Backend/ICountUsersBackend.php
@@ -29,11 +29,10 @@ namespace OCP\User\Backend;
* @since 14.0.0
*/
interface ICountUsersBackend {
-
/**
* @since 14.0.0
*
- * @return int|bool The number of users on success false on failure
+ * @return int|false The number of users on success false on failure
*/
public function countUsers();
}