libs/PHPCrawler.class.php
protected function initCrawlerProcess()
  {
    // Create working directory
    $this->createWorkingDirectory();
    
    // Setup url-cache
    if ($this->url_cache_type == PHPCrawlerUrlCacheTypes::URLCACHE_SQLITE) 
      $this->LinkCache = new PHPCrawlerSQLiteURLCache($this->working_directory."urlcache.db3", true);
    else
      $this->LinkCache = new PHPCrawlerMemoryURLCache();
    
    // Perge/cleanup SQLite-urlcache for resumed crawling-processes (only ONCE!)
    if ($this->url_cache_type == PHPCrawlerUrlCacheTypes::URLCACHE_SQLITE && $this->urlcache_purged == false)
    {
      $this->LinkCache->purgeCache();
      $this->urlcache_purged = true;
    }
    
    // Setup cookie-cache (use SQLite-cache if crawler runs multi-processed)
    if ($this->url_cache_type == PHPCrawlerUrlCacheTypes::URLCACHE_SQLITE)
      $this->CookieCache = new PHPCrawlerSQLiteCookieCache($this->working_directory."cookiecache.db3", true);
    else $this->CookieCache = new PHPCrawlerMemoryCookieCache();
    
    // ProcessCommunication
    $this->ProcessCommunication = new PHPCrawlerProcessCommunication($this->crawler_uniqid, $this->multiprocess_mode, $this->working_directory, $this->resumtion_enabled);
    
    // DocumentInfo-Queue
    if ($this->multiprocess_mode == PHPCrawlerMultiProcessModes::MPMODE_PARENT_EXECUTES_USERCODE)
      $this->DocumentInfoQueue = new PHPCrawlerDocumentInfoQueue($this->working_directory."doc_queue.db3", true);
    
    // Set tmp-file for PageRequest
    $this->PageRequest->setTmpFile($this->working_directory."phpcrawl_".getmypid().".tmp");
    
    // Pass url-priorities to link-cache
    $this->LinkCache->addLinkPriorities($this->link_priority_array);
                
    // Pass base-URL to the UrlFilter
    $this->UrlFilter->setBaseURL($this->starting_url);
    
    // Add the starting-URL to the url-cache
    $this->LinkCache->addUrl(new PHPCrawlerURLDescriptor($this->starting_url));
  }
protected function initCrawlerProcess()
  {
    // Create working directory
    $this->createWorkingDirectory();
    
    // Setup url-cache
    if ($this->url_cache_type == PHPCrawlerUrlCacheTypes::URLCACHE_SQLITE) 
      $this->LinkCache = new PHPCrawlerSQLiteURLCache($this->working_directory."urlcache.db3", true);
    else
      $this->LinkCache = new PHPCrawlerMemoryURLCache();
    
    // Perge/cleanup SQLite-urlcache for resumed crawling-processes (only ONCE!)
    if ($this->url_cache_type == PHPCrawlerUrlCacheTypes::URLCACHE_SQLITE && $this->urlcache_purged == false)
    {
      $this->LinkCache->purgeCache();
      $this->urlcache_purged = true;
    }
    
    // Setup cookie-cache (use SQLite-cache if crawler runs multi-processed)
    if ($this->url_cache_type == PHPCrawlerUrlCacheTypes::URLCACHE_SQLITE)
      $this->CookieCache = new PHPCrawlerSQLiteCookieCache($this->working_directory."cookiecache.db3", true);
    else $this->CookieCache = new PHPCrawlerMemoryCookieCache();
    
    // ProcessCommunication
    $this->ProcessCommunication = new PHPCrawlerProcessCommunication($this->crawler_uniqid, $this->multiprocess_mode, $this->working_directory, $this->resumtion_enabled);
    
    // DocumentInfo-Queue
    if ($this->multiprocess_mode == PHPCrawlerMultiProcessModes::MPMODE_PARENT_EXECUTES_USERCODE)
      $this->DocumentInfoQueue = new PHPCrawlerDocumentInfoQueue($this->working_directory."doc_queue.db3", true);
    
    // Set tmp-file for PageRequest
    $this->PageRequest->setTmpFile($this->working_directory."phpcrawl_".getmypid().".tmp");
    
    // Pass url-priorities to link-cache
    $this->LinkCache->addLinkPriorities($this->link_priority_array);
                
    // Pass base-URL to the UrlFilter
    $this->UrlFilter->setBaseURL($this->starting_url);
    
    // Add the starting-URL to the url-cache
    $this->LinkCache->addUrl(new PHPCrawlerURLDescriptor($this->starting_url));
  }
Initiates a crawler-process