From eb3e70a7b7bd96099c5cef15c63417e0f9eef171 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 3 May 2023 04:17:58 +0300 Subject: [PATCH] fix robots.txt conditions --- crontab/cleaner.php | 2 +- crontab/crawler.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crontab/cleaner.php b/crontab/cleaner.php index a7e5674..f3f9ca2 100644 --- a/crontab/cleaner.php +++ b/crontab/cleaner.php @@ -57,7 +57,7 @@ foreach ($db->getCleanerQueue(CLEAN_HOST_LIMIT, time() - CLEAN_HOST_SECONDS_OFFS } // Apply new robots.txt rules - $robots = new Robots((!$hostRobots ? (string) $hostRobots : (string) CRAWL_ROBOTS_DEFAULT_RULES) . PHP_EOL . ($host->robotsPostfix ? (string) $host->robotsPostfix : (string) CRAWL_ROBOTS_POSTFIX_RULES)); + $robots = new Robots(($hostRobots ? (string) $hostRobots : (string) CRAWL_ROBOTS_DEFAULT_RULES) . PHP_EOL . ($host->robotsPostfix ? (string) $host->robotsPostfix : (string) CRAWL_ROBOTS_POSTFIX_RULES)); foreach ($db->getHostPages($host->hostId) as $hostPage) { diff --git a/crontab/crawler.php b/crontab/crawler.php index 7085002..b22224f 100644 --- a/crontab/crawler.php +++ b/crontab/crawler.php @@ -218,7 +218,7 @@ foreach ($db->getCrawlQueue(CRAWL_PAGE_LIMIT, time() - CRAWL_PAGE_SECONDS_OFFSET } // Init robots parser - $robots = new Robots((!$hostRobots ? (string) $hostRobots : (string) CRAWL_ROBOTS_DEFAULT_RULES) . PHP_EOL . (string) $hostRobotsPostfix); + $robots = new Robots(($hostRobots ? (string) $hostRobots : (string) CRAWL_ROBOTS_DEFAULT_RULES) . PHP_EOL . ($hostRobotsPostfix ? (string) $hostRobotsPostfix : (string) CRAWL_ROBOTS_POSTFIX_RULES)); // Save page info if ($hostStatus && // host enabled