diff options
Diffstat (limited to 'lib/private/user/database.php')
-rw-r--r-- | lib/private/user/database.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/private/user/database.php b/lib/private/user/database.php index c99db3b27ca..1a63755b980 100644 --- a/lib/private/user/database.php +++ b/lib/private/user/database.php @@ -253,4 +253,19 @@ class OC_User_Database extends OC_User_Backend { return true; } + /** + * counts the users in the database + * + * @return int | bool + */ + public function countUsers() { + $query = OC_DB::prepare('SELECT COUNT(*) FROM `*PREFIX*users`'); + $result = $query->execute(); + if (OC_DB::isError($result)) { + OC_Log::write('core', OC_DB::getErrorMessage($result), OC_Log::ERROR); + return false; + } + return $result->fetchOne(); + } + } |