libs/PHPCrawler.class.php
public function resume($crawler_id)
  {
    if ($this->resumtion_enabled == false)
      throw new Exception("Resumption was not enalbled, call enableResumption() before calling the resume()-method!");
    
    // Adobt crawler-id
    $this->crawler_uniqid = $crawler_id;
    
    if (!file_exists($this->working_base_directory."phpcrawl_tmp_".$this->crawler_uniqid.DIRECTORY_SEPARATOR))
    {
      throw new Exception("Couldn't find any previous aborted crawling-process with crawler-id '".$this->crawler_uniqid."'");
    }
    
    $this->createWorkingDirectory();
    
    // Unlinks pids file in working-dir (because all PIDs will change in new process)
    if (file_exists($this->working_directory."pids")) unlink($this->working_directory."pids");
  }
public function resume($crawler_id)
  {
    if ($this->resumtion_enabled == false)
      throw new Exception("Resumption was not enalbled, call enableResumption() before calling the resume()-method!");
    
    // Adobt crawler-id
    $this->crawler_uniqid = $crawler_id;
    
    if (!file_exists($this->working_base_directory."phpcrawl_tmp_".$this->crawler_uniqid.DIRECTORY_SEPARATOR))
    {
      throw new Exception("Couldn't find any previous aborted crawling-process with crawler-id '".$this->crawler_uniqid."'");
    }
    
    $this->createWorkingDirectory();
    
    // Unlinks pids file in working-dir (because all PIDs will change in new process)
    if (file_exists($this->working_directory."pids")) unlink($this->working_directory."pids");
  }
Resumes the crawling-process with the given crawler-ID

If a crawling-process was aborted (for whatever reasons), it is possible
to resume it by calling the resume()-method before calling the go() or goMultiProcessed() method
and passing the crawler-ID of the aborted process to it (as returned by {@link getCrawlerId()}).

In order to be able to resume a process, it is necessary that it was initially
started with resumption enabled (by calling the {@link enableResumption()} method).

This method throws an exception if resuming of a crawling-process failed.


Example of a resumeable crawler-script:
<code>
// ...
$crawler = new MyCrawler();
$crawler->enableResumption();
$crawler->setURL("www.url123.com");

// If process was started the first time:
// Get the crawler-ID and store it somewhere in order to be able to resume the process later on
if (!file_exists("/tmp/crawlerid_for_url123.tmp"))
{
$crawler_id = $crawler->getCrawlerId();
file_put_contents("/tmp/crawlerid_for_url123.tmp", $crawler_id);
}

// If process was restarted again (after a termination):
// Read the crawler-id and resume the process
else
{
$crawler_id = file_get_contents("/tmp/crawlerid_for_url123.tmp");
$crawler->resume($crawler_id);
}

// ...

// Start your crawling process
$crawler->goMultiProcessed(5);

// After the process is finished completely: Delete the crawler-ID
unlink("/tmp/crawlerid_for_url123.tmp");
</code>

@param int $crawler_id The crawler-ID of the crawling-process that should be resumed.
(see {@link getCrawlerId()})
@section 9 Process resumption