/**
  * Dispatching of a single or a chunk of ids in either online or batch mode
  * using the JobQueueScheduler
  *
  * @since 2.3
  *
  * @param integer &$id
  */
 public function startRebuildWith(&$id)
 {
     $updateJobs = array();
     $this->dispatchedEntities = array();
     // was nothing done in this run?
     $emptyRange = true;
     $this->createUpdateJobsForTitleIdRange($id, $updateJobs);
     if ($updateJobs !== array()) {
         $emptyRange = false;
     }
     $this->createUpdateJobsForSmwIdRange($id, $updateJobs, $emptyRange);
     // Deprecated since 2.3, use 'SMW::SQLStore::BeforeDataRebuildJobInsert'
     \Hooks::run('smwRefreshDataJobs', array(&$updateJobs));
     Hooks::run('SMW::SQLStore::BeforeDataRebuildJobInsert', array($this->store, &$updateJobs));
     if ($this->useJobQueueScheduler) {
         $this->jobFactory->batchInsert($updateJobs);
     } else {
         foreach ($updateJobs as $job) {
             $job->run();
         }
     }
     // -1 means that no next position is available
     $this->findNextIdPosition($id, $emptyRange);
     return $this->progress = $id > 0 ? $id / $this->getMaxId() : 1;
 }