fix order of initalizing instance properties, and paremeter order in a method call

This commit is contained in:
Arthur Schiwon 2015-01-08 17:45:07 +01:00
parent c7f273040e
commit c1a79d24c5
1 changed files with 12 additions and 10 deletions

View File

@ -8,10 +8,12 @@
namespace OCA\User_LDAP\Jobs; namespace OCA\User_LDAP\Jobs;
use \OC\BackgroundJob\TimedJob;
use \OCA\user_ldap\User_LDAP;
use \OCA\user_ldap\User_Proxy; use \OCA\user_ldap\User_Proxy;
use \OCA\user_ldap\lib\Helper; use \OCA\user_ldap\lib\Helper;
use \OCA\user_ldap\lib\LDAP; use \OCA\user_ldap\lib\LDAP;
use \OCA\User_LDAP\lib\User\DeletedUsersIndex; use \OCA\user_ldap\lib\user\DeletedUsersIndex;
use \OCA\User_LDAP\Mapping\UserMapping; use \OCA\User_LDAP\Mapping\UserMapping;
/** /**
@ -21,14 +23,14 @@ use \OCA\User_LDAP\Mapping\UserMapping;
* *
* @package OCA\user_ldap\lib; * @package OCA\user_ldap\lib;
*/ */
class CleanUp extends \OC\BackgroundJob\TimedJob { class CleanUp extends TimedJob {
/** @var int $limit amount of users that should be checked per run */ /** @var int $limit amount of users that should be checked per run */
protected $limit = 50; protected $limit = 50;
/** @var int $defaultIntervalMin default interval in minutes */ /** @var int $defaultIntervalMin default interval in minutes */
protected $defaultIntervalMin = 51; protected $defaultIntervalMin = 51;
/** @var \OCP\UserInterface $userBackend */ /** @var User_LDAP|User_Proxy $userBackend */
protected $userBackend; protected $userBackend;
/** @var \OCP\IConfig $ocConfig */ /** @var \OCP\IConfig $ocConfig */
@ -68,6 +70,12 @@ class CleanUp extends \OC\BackgroundJob\TimedJob {
$this->ldapHelper = new Helper(); $this->ldapHelper = new Helper();
} }
if(isset($arguments['ocConfig'])) {
$this->ocConfig = $arguments['ocConfig'];
} else {
$this->ocConfig = \OC::$server->getConfig();
}
if(isset($arguments['userBackend'])) { if(isset($arguments['userBackend'])) {
$this->userBackend = $arguments['userBackend']; $this->userBackend = $arguments['userBackend'];
} else { } else {
@ -78,12 +86,6 @@ class CleanUp extends \OC\BackgroundJob\TimedJob {
); );
} }
if(isset($arguments['ocConfig'])) {
$this->ocConfig = $arguments['ocConfig'];
} else {
$this->ocConfig = \OC::$server->getConfig();
}
if(isset($arguments['db'])) { if(isset($arguments['db'])) {
$this->db = $arguments['db']; $this->db = $arguments['db'];
} else { } else {
@ -114,7 +116,7 @@ class CleanUp extends \OC\BackgroundJob\TimedJob {
if(!$this->isCleanUpAllowed()) { if(!$this->isCleanUpAllowed()) {
return; return;
} }
$users = $this->mapping->getList($this->limit, $this->getOffset()); $users = $this->mapping->getList($this->getOffset(), $this->limit);
if(!is_array($users)) { if(!is_array($users)) {
//something wrong? Let's start from the beginning next time and //something wrong? Let's start from the beginning next time and
//abort //abort