libs/PHPCrawler.class.php
protected function checkForAbort()
  {
    PHPCrawlerBenchmark::start("checkning_for_abort");
    
    $abort_reason = null;
     
    // Get current status
    $crawler_status = $this->ProcessCommunication->getCrawlerStatus();
    
    // if crawlerstatus already marked for ABORT
    if ($crawler_status->abort_reason !== null)
    {
      $abort_reason = $crawler_status->abort_reason;
    }
    
    // Check for reached limits
    
    // If traffic-limit is reached
    if ($this->traffic_limit > 0 && $crawler_status->bytes_received >= $this->traffic_limit)
      $abort_reason = PHPCrawlerAbortReasons::ABORTREASON_TRAFFICLIMIT_REACHED;
    
    // If document-limit is set
    if ($this->document_limit > 0)
    {
      // If document-limit regards to received documetns
      if ($this->only_count_received_documents == true && $crawler_status->documents_received >= $this->document_limit)
      {
        $abort_reason = PHPCrawlerAbortReasons::ABORTREASON_FILELIMIT_REACHED;
      }
      elseif ($this->only_count_received_documents == false && $crawler_status->links_followed >= $this->document_limit)
      {
        $abort_reason = PHPCrawlerAbortReasons::ABORTREASON_FILELIMIT_REACHED;
      }
    }
    
    $this->ProcessCommunication->updateCrawlerStatus(null, $abort_reason);
    
    PHPCrawlerBenchmark::stop("checkning_for_abort");
    
    return $abort_reason;
  }
protected function checkForAbort()
  {
    PHPCrawlerBenchmark::start("checkning_for_abort");
    
    $abort_reason = null;
     
    // Get current status
    $crawler_status = $this->ProcessCommunication->getCrawlerStatus();
    
    // if crawlerstatus already marked for ABORT
    if ($crawler_status->abort_reason !== null)
    {
      $abort_reason = $crawler_status->abort_reason;
    }
    
    // Check for reached limits
    
    // If traffic-limit is reached
    if ($this->traffic_limit > 0 && $crawler_status->bytes_received >= $this->traffic_limit)
      $abort_reason = PHPCrawlerAbortReasons::ABORTREASON_TRAFFICLIMIT_REACHED;
    
    // If document-limit is set
    if ($this->document_limit > 0)
    {
      // If document-limit regards to received documetns
      if ($this->only_count_received_documents == true && $crawler_status->documents_received >= $this->document_limit)
      {
        $abort_reason = PHPCrawlerAbortReasons::ABORTREASON_FILELIMIT_REACHED;
      }
      elseif ($this->only_count_received_documents == false && $crawler_status->links_followed >= $this->document_limit)
      {
        $abort_reason = PHPCrawlerAbortReasons::ABORTREASON_FILELIMIT_REACHED;
      }
    }
    
    $this->ProcessCommunication->updateCrawlerStatus(null, $abort_reason);
    
    PHPCrawlerBenchmark::stop("checkning_for_abort");
    
    return $abort_reason;
  }
Checks if the crawling-process should be aborted.

@return int NULL if the process shouldn't be aborted yet, otherwise one of the PHPCrawlerAbortReasons::ABORTREASON-constants.