From 45638a5de3c8c05c1792f8a3ab93acb11a2c1a86 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 30 Aug 2016 08:13:33 +0200 Subject: Option to disable linked URL indexing Resolves: #2 --- src/phinde/Crawler.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/phinde/Crawler.php b/src/phinde/Crawler.php index 43d9459..6459fb4 100644 --- a/src/phinde/Crawler.php +++ b/src/phinde/Crawler.php @@ -84,11 +84,19 @@ class Crawler if ($this->es->isKnown($linkInfo->url)) { continue; } - $this->es->markQueued($linkInfo->url); - $this->queue->addToIndex( - $linkInfo->url, $linkInfo->title, $linkInfo->source - ); - if (Helper::isUrlAllowed($linkInfo->url)) { + $allowed = Helper::isUrlAllowed($linkInfo->url); + $crawl = $allowed; + $index = $GLOBALS['phinde']['indexNonAllowed'] || $allowed; + + if ($crawl || $index) { + $this->es->markQueued($linkInfo->url); + } + if ($index) { + $this->queue->addToIndex( + $linkInfo->url, $linkInfo->title, $linkInfo->source + ); + } + if ($allowed) { $this->queue->addToCrawl($linkInfo->url); } } -- cgit v1.2.3