From 593ef76e36a0167e87e30072730f8b6d91bb228e Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Thu, 20 Nov 2014 22:02:26 +0100 Subject: Revert "drop OC_Preferences::getUsers and getApps" This reverts commit 09fd34eed908203674721af86ce889bfd0a0ef8d. --- lib/private/preferences.php | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'lib/private/preferences.php') diff --git a/lib/private/preferences.php b/lib/private/preferences.php index 58f75419497..cdaa207449d 100644 --- a/lib/private/preferences.php +++ b/lib/private/preferences.php @@ -67,6 +67,25 @@ class Preferences { $this->conn = $conn; } + /** + * Get all users using the preferences + * @return array an array of user ids + * + * This function returns a list of all users that have at least one entry + * in the preferences table. + */ + public function getUsers() { + $query = 'SELECT DISTINCT `userid` FROM `*PREFIX*preferences`'; + $result = $this->conn->executeQuery($query); + + $users = array(); + while ($userid = $result->fetchColumn()) { + $users[] = $userid; + } + + return $users; + } + /** * @param string $user * @return array[] @@ -89,6 +108,19 @@ class Preferences { return $data; } + /** + * Get all apps of an user + * @param string $user user + * @return integer[] with app ids + * + * This function returns a list of all apps of the user that have at least + * one entry in the preferences table. + */ + public function getApps($user) { + $data = $this->getUserValues($user); + return array_keys($data); + } + /** * Get the available keys for an app * @param string $user user -- cgit v1.2.3