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

contentloader: log warning when icon/thumbnail directories are not writeable #1009

Merged
merged 1 commit into from
Jan 8, 2018
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
20 changes: 14 additions & 6 deletions helpers/ContentLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,12 +299,16 @@ protected function fetchThumbnail($thumbnail, $newItem) {
$imageHelper = new \helpers\Image();
$thumbnailAsJpg = $imageHelper->loadImage($thumbnail, $extension, 500, 500);
if ($thumbnailAsJpg !== false) {
file_put_contents(
$written = file_put_contents(
'data/thumbnails/' . md5($thumbnail) . '.' . $extension,
$thumbnailAsJpg
);
$newItem['thumbnail'] = md5($thumbnail) . '.' . $extension;
\F3::get('logger')->debug('thumbnail generated: ' . $thumbnail);
if ($written !== false) {
$newItem['thumbnail'] = md5($thumbnail) . '.' . $extension;
\F3::get('logger')->debug('Thumbnail generated: ' . $thumbnail);
} else {
\F3::get('logger')->warning('Unable to store thumbnail: ' . $thumbnail . '. Please check permissions of data/thumbnails.');
}
} else {
$newItem['thumbnail'] = '';
\F3::get('logger')->error('thumbnail generation error: ' . $thumbnail);
Expand Down Expand Up @@ -333,13 +337,17 @@ protected function fetchIcon($icon, $newItem, &$lasticon) {
$imageHelper = new \helpers\Image();
$iconAsPng = $imageHelper->loadImage($icon, $extension, 30, null);
if ($iconAsPng !== false) {
file_put_contents(
$written = file_put_contents(
'data/favicons/' . md5($icon) . '.' . $extension,
$iconAsPng
);
$newItem['icon'] = md5($icon) . '.' . $extension;
$lasticon = $icon;
\F3::get('logger')->debug('icon generated: ' . $icon);
if ($written !== false) {
$newItem['icon'] = md5($icon) . '.' . $extension;
\F3::get('logger')->debug('Icon generated: ' . $icon);
} else {
\F3::get('logger')->warning('Unable to store icon: ' . $icon . '. Please check permissions of data/favicons.');
}
} else {
$newItem['icon'] = '';
\F3::get('logger')->error('icon generation error: ' . $icon);
Expand Down