You are here

protected function FeedsCrawlerBase::beginFetch in Feeds Crawler 7.2

Called before fetching the next link.

Subclasses can override this to manage state.

Parameters

FeedsSource $source: The feed source.

FeedsState $state: The state object.

2 calls to FeedsCrawlerBase::beginFetch()
FeedsCrawlerBase::fetch in src/FeedsCrawlerBase.php
FeedsCrawlerPattern::beginFetch in src/FeedsCrawlerPattern.php
Called before fetching the next link.
1 method overrides FeedsCrawlerBase::beginFetch()
FeedsCrawlerPattern::beginFetch in src/FeedsCrawlerPattern.php
Called before fetching the next link.

File

src/FeedsCrawlerBase.php, line 173
Contains FeedsCrawler.

Class

FeedsCrawlerBase
The fetcher class that implements crawling.

Code

protected function beginFetch(FeedsSource $source, FeedsState $state) {
  if ($state->total == 0) {
    $state->total = $this->config['num_pages'] == 0 ? 100000 : $this->config['num_pages'];
    $state->count = $state->total;
    return;
  }
  sleep($this->config['delay']);
}