]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
use getByID (also bad variable reference)
authorMikael Nordfeldth <mmn@hethane.se>
Mon, 18 Apr 2016 13:08:47 +0000 (15:08 +0200)
committerMikael Nordfeldth <mmn@hethane.se>
Mon, 18 Apr 2016 13:08:47 +0000 (15:08 +0200)
classes/File_redirection.php

index 8a490fb18a6a0f8c0e92ae91bee1a90fb5e2f1a9..d1b266c90b4a89f96625ece8e3b81084040519b0 100644 (file)
@@ -173,12 +173,11 @@ class File_redirection extends Managed_DataObject
         try {
             $r = File_redirection::getByUrl($in_url);
 
-            $f = File::getKV('id',$r->file_id);
-
-            if($file instanceof File) {
+            try {
+                $f = File::getByID($r->file_id);
                 $r->file = $f;
-                $r->redir_url = $f->url;            
-            } else {
+                $r->redir_url = $f->url;
+            } catch (NoResultException $e) {
                 // Invalid entry, delete and run again
                 common_log(LOG_ERR, "Could not find File with id=".$r->file_id." referenced in File_redirection, deleting File redirection entry and and trying again...");                 
                 $r->delete();