updateOriginUrl: rewrite some if, resolving feedbacks from PR

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
This commit is contained in:
Kevin Decherf 2018-10-24 21:54:09 +02:00
parent b49c87acf1
commit 5ba5e22a09

View file

@ -321,7 +321,10 @@ class ContentProxy
*/
private function updateOriginUrl(Entry $entry, $url)
{
if (!empty($url) && $entry->getUrl() !== $url) {
if (empty($url) || $entry->getUrl() === $url) {
return false;
}
$parsed_entry_url = parse_url($entry->getUrl());
$parsed_content_url = parse_url($url);
@ -334,7 +337,9 @@ class ContentProxy
if ($this->ignoreUrl($entry->getUrl())) {
$entry->setUrl($url);
} else {
return false;
}
switch ($diff_keys) {
case ['path']:
if (($parsed_entry_url['path'] . '/' === $parsed_content_url['path']) // diff is trailing slash, we only replace the url of the entry
@ -358,8 +363,6 @@ class ContentProxy
break;
}
}
}
}
/**
* Check entry url against an ignore list to replace with content url.