From 9a2c73e86d2549a2cd63d7f772b4bb1a3956e46f Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Sat, 15 Feb 2014 12:36:15 +0100
Subject: [PATCH] streamlined retrieveUsers() signature over all auth plugins
 FS#2919

---
 lib/plugins/auth.php           | 4 ++--
 lib/plugins/authad/auth.php    | 4 ++--
 lib/plugins/authldap/auth.php  | 4 ++--
 lib/plugins/authmysql/auth.php | 2 +-
 lib/plugins/authpgsql/auth.php | 2 +-
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/lib/plugins/auth.php b/lib/plugins/auth.php
index dc66d6380..b04735639 100644
--- a/lib/plugins/auth.php
+++ b/lib/plugins/auth.php
@@ -316,11 +316,11 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin {
      *
      * @author  Chris Smith <chris@jalakai.co.uk>
      * @param   int   $start     index of first user to be returned
-     * @param   int   $limit     max number of users to be returned
+     * @param   int   $limit     max number of users to be returned, 0 for unlimited
      * @param   array $filter    array of field/pattern pairs, null for no filter
      * @return  array list of userinfo (refer getUserData for internal userinfo details)
      */
-    public function retrieveUsers($start = 0, $limit = -1, $filter = null) {
+    public function retrieveUsers($start = 0, $limit = 0, $filter = null) {
         msg("authorisation method does not support mass retrieval of user data", -1);
         return array();
     }
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php
index e1d758fb8..7e2d902bd 100644
--- a/lib/plugins/authad/auth.php
+++ b/lib/plugins/authad/auth.php
@@ -332,7 +332,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
      * @param   array $filter    array of field/pattern pairs, null for no filter
      * @return  array userinfo (refer getUserData for internal userinfo details)
      */
-    public function retrieveUsers($start = 0, $limit = -1, $filter = array()) {
+    public function retrieveUsers($start = 0, $limit = 0, $filter = array()) {
         $adldap = $this->_adldap(null);
         if(!$adldap) return false;
 
@@ -357,7 +357,7 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
             }
             if($this->_filter($user, $info)) {
                 $result[$user] = $info;
-                if(($limit >= 0) && (++$count >= $limit)) break;
+                if(($limit > 0) && (++$count >= $limit)) break;
             }
         }
         return $result;
diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php
index 94f3be8d2..6c3637e15 100644
--- a/lib/plugins/authldap/auth.php
+++ b/lib/plugins/authldap/auth.php
@@ -281,7 +281,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
      * @param   array $filter  array of field/pattern pairs, null for no filter
      * @return  array of userinfo (refer getUserData for internal userinfo details)
      */
-    function retrieveUsers($start = 0, $limit = -1, $filter = array()) {
+    function retrieveUsers($start = 0, $limit = 0, $filter = array()) {
         if(!$this->_openLDAP()) return false;
 
         if(is_null($this->users)) {
@@ -316,7 +316,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
             }
             if($this->_filter($user, $info)) {
                 $result[$user] = $info;
-                if(($limit >= 0) && (++$count >= $limit)) break;
+                if(($limit > 0) && (++$count >= $limit)) break;
             }
         }
         return $result;
diff --git a/lib/plugins/authmysql/auth.php b/lib/plugins/authmysql/auth.php
index 036644a67..3ebd5123f 100644
--- a/lib/plugins/authmysql/auth.php
+++ b/lib/plugins/authmysql/auth.php
@@ -352,7 +352,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
      * @param  array|string $filter array of field/pattern pairs
      * @return  array userinfo (refer getUserData for internal userinfo details)
      */
-    public function retrieveUsers($first = 0, $limit = 10, $filter = array()) {
+    public function retrieveUsers($first = 0, $limit = 0, $filter = array()) {
         $out = array();
 
         if($this->_openDB()) {
diff --git a/lib/plugins/authpgsql/auth.php b/lib/plugins/authpgsql/auth.php
index 3f8ff3249..240db80fa 100644
--- a/lib/plugins/authpgsql/auth.php
+++ b/lib/plugins/authpgsql/auth.php
@@ -148,7 +148,7 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql {
      * @param   array $filter    array of field/pattern pairs
      * @return  array userinfo (refer getUserData for internal userinfo details)
      */
-    public function retrieveUsers($first = 0, $limit = 10, $filter = array()) {
+    public function retrieveUsers($first = 0, $limit = 0, $filter = array()) {
         $out = array();
 
         if($this->_openDB()) {
-- 
GitLab