// if logo is an uploaded file, try to fall back to HTTPS file URL
$httpUrl = common_config('site', 'logo');
if (!empty($httpUrl)) {
- $f = File::getKV('url', $httpUrl);
- if (!empty($f) && !empty($f->filename)) {
- // this will handle the HTTPS case
- $logoUrl = File::url($f->filename);
+ try {
+ $f = File::getByUrl('url', $httpUrl);
+ if (!empty($f->filename)) {
+ // this will handle the HTTPS case
+ $logoUrl = File::url($f->filename);
+ }
+ } catch (NoResultException $e) {
+ // no match
}
}
}
$file_oembed->url = $data->url;
$given_url = File_redirection::_canonUrl($file_oembed->url);
if (! empty($given_url)){
- $file = File::getKV('url', $given_url);
- if ($file instanceof File) {
+ try {
+ $file = File::getByUrl($given_url);
$file_oembed->mimetype = $file->mimetype;
- } else {
+ } catch (NoResultException $e) {
$redir = File_redirection::where($given_url);
if (empty($redir->file_id)) {
$f = $redir->getFile();