1
0
mirror of https://github.com/YGGverse/Yo.git synced 2025-03-13 05:41:18 +00:00

fix undefined variable, minor optimization

This commit is contained in:
yggverse 2024-04-06 02:48:25 +03:00
parent f12c897d34
commit 0559ae3a58

@ -301,6 +301,10 @@ foreach($index->search('')
); );
// Crawl links // Crawl links
$base = new \Yggverse\Net\Address(
$document->get('url')
);
$documents = []; $documents = [];
foreach ($body->getLinks() as $line) foreach ($body->getLinks() as $line)
@ -318,10 +322,6 @@ foreach($index->search('')
if ($address->isRelative()) if ($address->isRelative())
{ {
$base = new \Yggverse\Net\Address(
$document->get('url')
);
if ($absolute = $address->getAbsolute($base)) if ($absolute = $address->getAbsolute($base))
{ {
$url = $absolute; $url = $absolute;
@ -335,7 +335,7 @@ foreach($index->search('')
} }
// External host rules // External host rules
if (!$config->cli->document->crawl->url->external && parse_url($url, PHP_URL_HOST) != $host) if (!$config->cli->document->crawl->url->external && $address->getHost() != $base->getHost())
{ {
continue; continue;
} }