Style
This commit is contained in:
parent
aed5e4cc96
commit
903c646a62
|
@ -45,7 +45,7 @@ class Link
|
||||||
Logger::info('Found', ['id' => $id, 'url' => $url]);
|
Logger::info('Found', ['id' => $id, 'url' => $url]);
|
||||||
} else {
|
} else {
|
||||||
$mime = self::fetchMimeType($url);
|
$mime = self::fetchMimeType($url);
|
||||||
|
|
||||||
DBA::insert('post-link', ['uri-id' => $uri_id, 'url' => $url, 'mimetype' => $mime]);
|
DBA::insert('post-link', ['uri-id' => $uri_id, 'url' => $url, 'mimetype' => $mime]);
|
||||||
$id = DBA::lastInsertId();
|
$id = DBA::lastInsertId();
|
||||||
Logger::info('Inserted', ['id' => $id, 'url' => $url]);
|
Logger::info('Inserted', ['id' => $id, 'url' => $url]);
|
||||||
|
@ -79,6 +79,7 @@ class Link
|
||||||
private static function fetchMimeType(string $url)
|
private static function fetchMimeType(string $url)
|
||||||
{
|
{
|
||||||
$timeout = DI::config()->get('system', 'xrd_timeout');
|
$timeout = DI::config()->get('system', 'xrd_timeout');
|
||||||
|
|
||||||
$curlResult = DI::httpRequest()->head($url, ['timeout' => $timeout]);
|
$curlResult = DI::httpRequest()->head($url, ['timeout' => $timeout]);
|
||||||
if ($curlResult->isSuccess()) {
|
if ($curlResult->isSuccess()) {
|
||||||
if (empty($media['mimetype'])) {
|
if (empty($media['mimetype'])) {
|
||||||
|
|
Loading…
Reference in a new issue