diff options
author | blizzz <blizzz@arthur-schiwon.de> | 2019-11-21 11:05:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-21 11:05:54 +0100 |
commit | e7f225c013a6e55fdc84587b9103a75fc94eed1b (patch) | |
tree | eb52986c69bd1b81333e446347e503e7632035dc /apps | |
parent | 4d5f58256a6230ddaf0db4c8866bdb509f11d39e (diff) | |
parent | f990620e6be829341ae590f928c8adacd853f69e (diff) | |
download | nextcloud-server-e7f225c013a6e55fdc84587b9103a75fc94eed1b.tar.gz nextcloud-server-e7f225c013a6e55fdc84587b9103a75fc94eed1b.zip |
Merge pull request #18016 from nextcloud/fix/noid/ldap-checkup-batchsize
make chunksize (used to check for gone LDAP users) configurable
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_ldap/lib/Jobs/CleanUp.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/apps/user_ldap/lib/Jobs/CleanUp.php b/apps/user_ldap/lib/Jobs/CleanUp.php index f905256c696..295cb14c7aa 100644 --- a/apps/user_ldap/lib/Jobs/CleanUp.php +++ b/apps/user_ldap/lib/Jobs/CleanUp.php @@ -44,7 +44,7 @@ use OCA\User_LDAP\User\DeletedUsersIndex; */ class CleanUp extends TimedJob { /** @var int $limit amount of users that should be checked per run */ - protected $limit = 50; + protected $limit; /** @var int $defaultIntervalMin default interval in minutes */ protected $defaultIntervalMin = 51; @@ -61,10 +61,10 @@ class CleanUp extends TimedJob { /** @var Helper $ldapHelper */ protected $ldapHelper; - /** @var \OCA\User_LDAP\Mapping\UserMapping */ + /** @var UserMapping */ protected $mapping; - /** @var \OCA\User_LDAP\User\DeletedUsersIndex */ + /** @var DeletedUsersIndex */ protected $dui; public function __construct() { @@ -138,7 +138,7 @@ class CleanUp extends TimedJob { if(!$this->isCleanUpAllowed()) { return; } - $users = $this->mapping->getList($this->getOffset(), $this->limit); + $users = $this->mapping->getList($this->getOffset(), $this->getChunkSize()); if(!is_array($users)) { //something wrong? Let's start from the beginning next time and //abort @@ -156,7 +156,7 @@ class CleanUp extends TimedJob { * @return bool */ public function isOffsetResetNecessary($resultCount) { - return $resultCount < $this->limit; + return $resultCount < $this->getChunkSize(); } /** @@ -222,7 +222,7 @@ class CleanUp extends TimedJob { */ public function setOffset($reset = false) { $newOffset = $reset ? 0 : - $this->getOffset() + $this->limit; + $this->getOffset() + $this->getChunkSize(); $this->ocConfig->setAppValue('user_ldap', 'cleanUpJobOffset', $newOffset); } @@ -231,6 +231,9 @@ class CleanUp extends TimedJob { * @return int */ public function getChunkSize() { + if($this->limit === null) { + $this->limit = (int)$this->ocConfig->getAppValue('user_ldap', 'cleanUpJobChunkSize', 50); + } return $this->limit; } |