diff options
| author | 2017-04-09 08:58:41 +0200 | |
|---|---|---|
| committer | 2017-04-09 08:58:41 +0200 | |
| commit | c5e9fee5a7700b3ba8fae4e1c454e8fd46606d8b (patch) | |
| tree | 89da02a926af07520b02b030c5dd9fbedf515ed8 | |
| parent | 8af3c9841e7040b91282f24cdccc0e215c52ceef (diff) | |
| parent | a542ab8fff7cd13ef54f5585f029b6c1d2244351 (diff) | |
Merge pull request #1491 from Alkarex/check_fileinfo
Check for fileinfo
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | app/install.php | 2 | ||||
| -rw-r--r-- | lib/Favicon/Favicon.php | 14 | ||||
| -rw-r--r-- | lib/lib_install.php | 2 |
4 files changed, 12 insertions, 7 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index de9f2cc5d..e8a15ad1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ * Bug fixing * Fix SQL uniqueness bug with PostgreSQL [#1476](https://github.com/FreshRSS/FreshRSS/pull/1476) * (Require manual update for existing installations) + * Do not require PHP extension `fileinfo` for favicons [#1461](https://github.com/FreshRSS/FreshRSS/issues/1461) * Fix UI lowest subscription popup hidden [#1479](https://github.com/FreshRSS/FreshRSS/issues/1479) * I18n * Improve English [#1465](https://github.com/FreshRSS/FreshRSS/pull/1465) diff --git a/app/install.php b/app/install.php index f598f6528..ebfffa47d 100644 --- a/app/install.php +++ b/app/install.php @@ -465,7 +465,7 @@ function printStep1() { <?php if ($res['fileinfo'] == 'ok') { ?> <p class="alert alert-success"><span class="alert-head"><?php echo _t('gen.short.ok'); ?></span> <?php echo _t('install.check.fileinfo.ok'); ?></p> <?php } else { ?> - <p class="alert alert-error"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.fileinfo.nok'); ?></p> + <p class="alert alert-warn"><span class="alert-head"><?php echo _t('gen.short.damn'); ?></span> <?php echo _t('install.check.fileinfo.nok'); ?></p> <?php } ?> <?php if ($res['data'] == 'ok') { ?> diff --git a/lib/Favicon/Favicon.php b/lib/Favicon/Favicon.php index 8571a1b95..85d2ef19b 100644 --- a/lib/Favicon/Favicon.php +++ b/lib/Favicon/Favicon.php @@ -179,7 +179,7 @@ class Favicon // Sometimes people lie, so check the status. // And sometimes, it's not even an image. Sneaky bastards! // If cacheDir isn't writable, that's not our problem - if ($favicon && is_writable($this->cacheDir) && !$this->checkImageMType($favicon)) { + if ($favicon && is_writable($this->cacheDir) && extension_loaded('fileinfo') && !$this->checkImageMType($favicon)) { $favicon = false; } @@ -229,10 +229,14 @@ class Favicon $fileContent = $this->dataAccess->retrieveUrl($url); $this->dataAccess->saveCache($tmpFile, $fileContent); - $finfo = finfo_open(FILEINFO_MIME_TYPE); - $isImage = strpos(finfo_file($finfo, $tmpFile), 'image') !== false; - finfo_close($finfo); - + $isImage = true; + try { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $isImage = strpos(finfo_file($finfo, $tmpFile), 'image') !== false; + finfo_close($finfo); + } catch (Exception $e) { + } + unlink($tmpFile); return $isImage; diff --git a/lib/lib_install.php b/lib/lib_install.php index 76871c98a..c625a670a 100644 --- a/lib/lib_install.php +++ b/lib/lib_install.php @@ -67,7 +67,7 @@ function checkRequirements($dbType = '') { 'favicons' => $favicons ? 'ok' : 'ko', 'http_referer' => $http_referer ? 'ok' : 'ko', 'message' => $message ?: 'ok', - 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $fileinfo && $dom && $xml && + 'all' => $php && $minz && $curl && $pdo && $pcre && $ctype && $dom && $xml && $data && $cache && $users && $favicons && $http_referer && $message == '' ? 'ok' : 'ko' ); |
