]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Forgotten File::getByUrl conversations (performance++)
authorMikael Nordfeldth <mmn@hethane.se>
Tue, 29 Mar 2016 10:13:53 +0000 (12:13 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Tue, 29 Mar 2016 10:13:53 +0000 (12:13 +0200)
lib/action.php
plugins/Oembed/classes/File_oembed.php

index 6d6efb1cbc17f12a985052ecb72b992e7164e024..86b4908b3d2be0cf3cf3dd8fc6840b1bae3f5cb5 100644 (file)
@@ -661,10 +661,14 @@ class Action extends HTMLOutputter // lawsuit
                     // 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
                         }
                     }
                 }
index 246a74fea03751960153134c1be880ea64c0037d..95aa91ff4c5ab29da0808c125c3a5b7ffc0e7cd9 100644 (file)
@@ -120,10 +120,10 @@ class File_oembed extends Managed_DataObject
             $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();