From f12c897d346069abe1235351665e16f09c7af4fe Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 6 Apr 2024 02:18:52 +0300 Subject: [PATCH] update yggverse/net version api --- src/cli/document/crawl.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/cli/document/crawl.php b/src/cli/document/crawl.php index 7ba3434..badea88 100644 --- a/src/cli/document/crawl.php +++ b/src/cli/document/crawl.php @@ -311,15 +311,23 @@ foreach($index->search('') if ($url = $link->getAddress()) { - //Make relative links absolute - $url = \Yggverse\YoTools\Link::relative2absolute( - $document->get('url'), - $url, - $scheme, - $host, - $port, + // Convert relative links to absolute + $address = new \Yggverse\Net\Address( + $url ); + if ($address->isRelative()) + { + $base = new \Yggverse\Net\Address( + $document->get('url') + ); + + if ($absolute = $address->getAbsolute($base)) + { + $url = $absolute; + } + } + // Regex rules if (!preg_match($config->cli->document->crawl->url->regex, $url)) {