| @@ 115-134 (lines=20) @@ | ||
| 112 | * @param \Closure $callback |
|
| 113 | * @param string $search |
|
| 114 | */ |
|
| 115 | protected function callForAllUsers(\Closure $callback, $search = '') { |
|
| 116 | foreach ($this->userManager->getBackends() as $backend) { |
|
| 117 | $limit = 500; |
|
| 118 | $offset = 0; |
|
| 119 | do { |
|
| 120 | $users = $backend->getUsers($search, $limit, $offset); |
|
| 121 | foreach ($users as $user) { |
|
| 122 | $user = $this->userManager->get($user); |
|
| 123 | if (is_null($user)) { |
|
| 124 | continue; |
|
| 125 | } |
|
| 126 | $return = $callback($user); |
|
| 127 | if ($return === false) { |
|
| 128 | break; |
|
| 129 | } |
|
| 130 | } |
|
| 131 | $offset += $limit; |
|
| 132 | } while (count($users) >= $limit); |
|
| 133 | } |
|
| 134 | } |
|
| 135 | } |
|
| 136 | ||
| @@ 102-121 (lines=20) @@ | ||
| 99 | * @param \Closure $callback |
|
| 100 | * @param string $search |
|
| 101 | */ |
|
| 102 | protected function callForAllUsers(\Closure $callback, $search = '') { |
|
| 103 | foreach ($this->userManager->getBackends() as $backend) { |
|
| 104 | $limit = 500; |
|
| 105 | $offset = 0; |
|
| 106 | do { |
|
| 107 | $users = $backend->getUsers($search, $limit, $offset); |
|
| 108 | foreach ($users as $user) { |
|
| 109 | $user = $this->userManager->get($user); |
|
| 110 | if (is_null($user)) { |
|
| 111 | continue; |
|
| 112 | } |
|
| 113 | $return = $callback($user); |
|
| 114 | if ($return === false) { |
|
| 115 | break; |
|
| 116 | } |
|
| 117 | } |
|
| 118 | $offset += $limit; |
|
| 119 | } while (count($users) >= $limit); |
|
| 120 | } |
|
| 121 | } |
|
| 122 | } |
|
| 123 | ||