*/
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;
/** @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() {
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
* @return bool
*/
public function isOffsetResetNecessary($resultCount) {
- return $resultCount < $this->limit;
+ return $resultCount < $this->getChunkSize();
}
/**
*/
public function setOffset($reset = false) {
$newOffset = $reset ? 0 :
- $this->getOffset() + $this->limit;
+ $this->getOffset() + $this->getChunkSize();
$this->ocConfig->setAppValue('user_ldap', 'cleanUpJobOffset', $newOffset);
}
* @return int
*/
public function getChunkSize() {
+ if($this->limit === null) {
+ $this->limit = (int)$this->ocConfig->getAppValue('user_ldap', 'cleanUpJobChunkSize', 50);
+ }
return $this->limit;
}