public function updateCrawlerStatus($PageInfo, $abort_reason = null, $first_content_url = null)
  {
    PHPCrawlerBenchmark::start("updating_crawler_status");
    
    // Set semaphore if crawler is multiprocessed
    if ($this->multiprocess_mode == PHPCrawlerMultiProcessModes::MPMODE_CHILDS_EXECUTES_USERCODE || $this->resumtion_enabled == true)
    {
      $sem_key = sem_get($this->crawler_uniqid);
      sem_acquire($sem_key);
    }
    
    // Get current Status
    $crawler_status = $this->getCrawlerStatus();
    
    // Update status
    if ($PageInfo != null)
    {
      // Increase number of followed links
      $crawler_status->links_followed++;
      
      // Increase documents_received-counter
      if ($PageInfo->received == true) $crawler_status->documents_received++;
        
      // Increase bytes-counter
      $crawler_status->bytes_received += $PageInfo->bytes_received;
    }
    
    // Set abortreason
    if ($abort_reason !== null) $crawler_status->abort_reason = $abort_reason;
    
    // Set first_content_url
    if ($first_content_url !== null) $crawler_status->first_content_url = $first_content_url;
    
    // Write crawler-status back
    $this->setCrawlerStatus($crawler_status);
    
    // Remove semaphore if crawler is multiprocessed
    if ($this->multiprocess_mode == PHPCrawlerMultiProcessModes::MPMODE_CHILDS_EXECUTES_USERCODE || $this->resumtion_enabled == true)
    {
      sem_release($sem_key);
    }
    
    PHPCrawlerBenchmark::stop("updating_crawler_status");
  }
public function updateCrawlerStatus($PageInfo, $abort_reason = null, $first_content_url = null)
  {
    PHPCrawlerBenchmark::start("updating_crawler_status");
    
    // Set semaphore if crawler is multiprocessed
    if ($this->multiprocess_mode == PHPCrawlerMultiProcessModes::MPMODE_CHILDS_EXECUTES_USERCODE || $this->resumtion_enabled == true)
    {
      $sem_key = sem_get($this->crawler_uniqid);
      sem_acquire($sem_key);
    }
    
    // Get current Status
    $crawler_status = $this->getCrawlerStatus();
    
    // Update status
    if ($PageInfo != null)
    {
      // Increase number of followed links
      $crawler_status->links_followed++;
      
      // Increase documents_received-counter
      if ($PageInfo->received == true) $crawler_status->documents_received++;
        
      // Increase bytes-counter
      $crawler_status->bytes_received += $PageInfo->bytes_received;
    }
    
    // Set abortreason
    if ($abort_reason !== null) $crawler_status->abort_reason = $abort_reason;
    
    // Set first_content_url
    if ($first_content_url !== null) $crawler_status->first_content_url = $first_content_url;
    
    // Write crawler-status back
    $this->setCrawlerStatus($crawler_status);
    
    // Remove semaphore if crawler is multiprocessed
    if ($this->multiprocess_mode == PHPCrawlerMultiProcessModes::MPMODE_CHILDS_EXECUTES_USERCODE || $this->resumtion_enabled == true)
    {
      sem_release($sem_key);
    }
    
    PHPCrawlerBenchmark::stop("updating_crawler_status");
  }
public function updateCrawlerStatus ( $ PageInfo , $ abort_reason = null , $ first_content_url = null ) { PHPCrawlerBenchmark :: start ( "updating_crawler_status" ) ; // Set semaphore if crawler is multiprocessed
 if ( $ this -> multiprocess_mode == PHPCrawlerMultiProcessModes :: MPMODE_CHILDS_EXECUTES_USERCODE || $ this -> resumtion_enabled == true ) { $ sem_key = sem_get ( $ this -> crawler_uniqid ) ; sem_acquire ( $ sem_key ) ; } // Get current Status
 $ crawler_status = $ this -> getCrawlerStatus ( ) ; // Update status
 if ( $ PageInfo != null ) { // Increase number of followed links
 $ crawler_status -> links_followed ++ ; // Increase documents_received-counter
 if ( $ PageInfo -> received == true ) $ crawler_status -> documents_received ++ ; // Increase bytes-counter
 $ crawler_status -> bytes_received += $ PageInfo -> bytes_received ; } // Set abortreason
 if ( $ abort_reason !== null ) $ crawler_status -> abort_reason = $ abort_reason ; // Set first_content_url
 if ( $ first_content_url !== null ) $ crawler_status -> first_content_url = $ first_content_url ; // Write crawler-status back
 $ this -> setCrawlerStatus ( $ crawler_status ) ; // Remove semaphore if crawler is multiprocessed
 if ( $ this -> multiprocess_mode == PHPCrawlerMultiProcessModes :: MPMODE_CHILDS_EXECUTES_USERCODE || $ this -> resumtion_enabled == true ) { sem_release ( $ sem_key ) ; } PHPCrawlerBenchmark :: stop ( "updating_crawler_status" ) ; }
Updates the status of the crawler

@param PHPCrawlerDocumentInfo $PageInfo          The PHPCrawlerDocumentInfo-object of the last received document
or NULL if no document was received.
@param int                    $abort_reason      One of the PHPCrawlerAbortReasons::ABORTREASON-constants if the crawling-process
should get aborted, otherwise NULL
@param string                 $first_content_url The first URL some content was found in (or NULL if no content was found so far).
Updates the status of the crawler