Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log more useful things when checking a logo #2379

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions lib/Fetcher/FeedFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,10 @@ protected function getFavicon(FeedInterface $feed, string $url): ?string
$downloaded = true;

$this->logger->debug(
"Feed:{url} Logo:{logo} Status:{status}",
"Feed:{feed} Logo:{logo} Status:{status}",
[
'status' => $response->getStatusCode(),
'url' => $favicon_path,
'feed' => $url,
'logo' => $favicon
]
);
Expand All @@ -448,13 +448,28 @@ protected function getFavicon(FeedInterface $feed, string $url): ?string

// check if file is actually an image
if (!$is_image) {
$this->logger->debug(
"Downloaded file:{file} from {url} is not an image",
[
'file' => $favicon_path,
'url' => $favicon
]
);

$return = $this->faviconFactory->get($base_url);
return is_string($return) ? $return : null;
}

list($width, $height, $type, $attr) = getimagesize($favicon_path);
// check if image is square else fall back to favicon
if ($width !== $height) {
$this->logger->debug(
"Downloaded file:{file} from {url} is not square",
[
'file' => $favicon_path,
'url' => $favicon
]
);
$return = $this->faviconFactory->get($base_url);
return is_string($return) ? $return : null;
}
Expand Down