X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FFile_redirection.php;h=742a6143cc43a93278c579accf90faf891914861;hb=0df853183485add783c59e9fac3a58258918817b;hp=8a490fb18a6a0f8c0e92ae91bee1a90fb5e2f1a9;hpb=867cb225b630aa69fe8a54f514797e1b825dc0f5;p=quix0rs-gnu-social.git diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 8a490fb18a..742a6143cc 100644 --- a/classes/File_redirection.php +++ b/classes/File_redirection.php @@ -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(); @@ -446,8 +445,8 @@ class File_redirection extends Managed_DataObject } public function getFile() { - if(empty($this->file) && $this->file_id) { - $this->file = File::getKV('id', $this->file_id); + if (!$this->file instanceof File) { + $this->file = File::getByID($this->file_id); } return $this->file;