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

			return true;
		}

		$this->QueuedTask->updateProgress($id, 0);
		if ($this->SubordinateDb->verify() !== true) {
			$this->err(__d('cake_ldap', 'Tree of employees is broken. Perform a restore.'));
			$this->QueuedTask->markJobFailed($id, __d('cake_ldap', 'Tree of employees is broken. Perform a restore.'));

			return true;
		}

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

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

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

			return true;
		}

		$this->QueuedTask->updateProgress($id, 0);
		if ($this->SubordinateDb->verify() !== true) {
			$this->err(__d('cake_ldap', 'Tree of employees is broken. Perform a restore.'));
			$this->QueuedTask->markJobFailed($id, __d('cake_ldap', 'Tree of employees is broken. Perform a restore.'));

			return true;
		}

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

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

		return true;
	}
public function run ( $ data , $ id = null ) { $ this -> hr ( ) ; $ this -> out ( __d ( 'cake_ldap' , 'CakePHP Queue Order task.' ) ) ; $ queueLength = $ this -> ExtendQueuedTask -> getLengthQueue ( 'OrderEmployee' ) ; if ( $ queueLength > 0 ) { $ this -> out ( __d ( 'cake_ldap' , 'Found order task in queue: %d. Skipped.' , $ queueLength ) ) ; return true ; } $ this -> QueuedTask -> updateProgress ( $ id , 0 ) ; if ( $ this -> SubordinateDb -> verify ( ) !== true ) { $ this -> err ( __d ( 'cake_ldap' , 'Tree of employees is broken. Perform a restore.' ) ) ; $ this -> QueuedTask -> markJobFailed ( $ id , __d ( 'cake_ldap' , 'Tree of employees is broken. Perform a restore.' ) ) ; return true ; } $ this -> QueuedTask -> updateProgress ( $ id , 0.5 ) ; $ result = $ this -> SubordinateDb -> reorderEmployeeTree ( false ) ; if ( ! $ result ) { $ this -> QueuedTask -> markJobFailed ( $ id , __d ( 'cake_ldap' , 'Error on reorder tree of employee.' ) ) ; } $ this -> QueuedTask -> updateProgress ( $ id , 1 ) ; return true ; }
Main function.
Used for order 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 order tree of employee .