public function run($data, $id = null) {
		$result = true;
		$this->hr();
		$this->out(__d('cake_ldap', 'CakePHP Queue Recovery task.'));
		$queueLength = $this->ExtendQueuedTask->getLengthQueue('RecoveryEmployee');
		if ($queueLength > 0) {
			$this->out(__d('cake_ldap', 'Found recovery task in queue: %d. Skipped.', $queueLength));

			return true;
		}

		set_time_limit(RECOVER_TREE_EMPLOYEE_TIME_LIMIT);
		$this->QueuedTask->updateProgress($id, 0);
		if ($this->SubordinateDb->verify() === true) {
			$this->QueuedTask->markJobFailed($id, __d('cake_ldap', 'The recovery tree of employees is not required'));

			return true;
		}

		$this->QueuedTask->updateProgress($id, 0.33);
		if (!$this->SubordinateDb->recoverEmployeeTree(false)) {
			$result = false;
			$this->QueuedTask->markJobFailed($id, __d('cake_ldap', 'Error on recovery tree of employee.'));
		}

		$this->QueuedTask->updateProgress($id, 0.66);
		if ($result && !$this->SubordinateDb->syncInformation(null, $id)) {
			$this->QueuedTask->markJobFailed($id, __d('cake_ldap', 'Error on synchronizing the employee tree with LDAP server.'));
		}

		$this->QueuedTask->updateProgress($id, 1);

		return true;
	}
public function run($data, $id = null) {
		$result = true;
		$this->hr();
		$this->out(__d('cake_ldap', 'CakePHP Queue Recovery task.'));
		$queueLength = $this->ExtendQueuedTask->getLengthQueue('RecoveryEmployee');
		if ($queueLength > 0) {
			$this->out(__d('cake_ldap', 'Found recovery task in queue: %d. Skipped.', $queueLength));

			return true;
		}

		set_time_limit(RECOVER_TREE_EMPLOYEE_TIME_LIMIT);
		$this->QueuedTask->updateProgress($id, 0);
		if ($this->SubordinateDb->verify() === true) {
			$this->QueuedTask->markJobFailed($id, __d('cake_ldap', 'The recovery tree of employees is not required'));

			return true;
		}

		$this->QueuedTask->updateProgress($id, 0.33);
		if (!$this->SubordinateDb->recoverEmployeeTree(false)) {
			$result = false;
			$this->QueuedTask->markJobFailed($id, __d('cake_ldap', 'Error on recovery tree of employee.'));
		}

		$this->QueuedTask->updateProgress($id, 0.66);
		if ($result && !$this->SubordinateDb->syncInformation(null, $id)) {
			$this->QueuedTask->markJobFailed($id, __d('cake_ldap', 'Error on synchronizing the employee tree with LDAP server.'));
		}

		$this->QueuedTask->updateProgress($id, 1);

		return true;
	}
public function run ( $ data , $ id = null ) { $ result = true ; $ this -> hr ( ) ; $ this -> out ( __d ( 'cake_ldap' , 'CakePHP Queue Recovery task.' ) ) ; $ queueLength = $ this -> ExtendQueuedTask -> getLengthQueue ( 'RecoveryEmployee' ) ; if ( $ queueLength > 0 ) { $ this -> out ( __d ( 'cake_ldap' , 'Found recovery task in queue: %d. Skipped.' , $ queueLength ) ) ; return true ; } set_time_limit ( RECOVER_TREE_EMPLOYEE_TIME_LIMIT ) ; $ this -> QueuedTask -> updateProgress ( $ id , 0 ) ; if ( $ this -> SubordinateDb -> verify ( ) === true ) { $ this -> QueuedTask -> markJobFailed ( $ id , __d ( 'cake_ldap' , 'The recovery tree of employees is not required' ) ) ; return true ; } $ this -> QueuedTask -> updateProgress ( $ id , 0.33 ) ; if ( ! $ this -> SubordinateDb -> recoverEmployeeTree ( false ) ) { $ result = false ; $ this -> QueuedTask -> markJobFailed ( $ id , __d ( 'cake_ldap' , 'Error on recovery tree of employee.' ) ) ; } $ this -> QueuedTask -> updateProgress ( $ id , 0.66 ) ; if ( $ result && ! $ this -> SubordinateDb -> syncInformation ( null , $ id ) ) { $ this -> QueuedTask -> markJobFailed ( $ id , __d ( 'cake_ldap' , 'Error on synchronizing the employee tree with LDAP server.' ) ) ; } $ this -> QueuedTask -> updateProgress ( $ id , 1 ) ; return true ; }
Main function.
Used for recovery tree of employee.

@param array $data The array passed to QueuedTask->createJob()
@param int $id The id of the QueuedTask
@triggers Model.afterUpdateTree $this->SubordinateDb
@return bool Success
@throws RuntimeException when seconds are 0;
Main function . Used for recovery tree of employee .