From c48508d5905ae3f26ddaa6e65f6e7da15b764ee1 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Mon, 18 Apr 2016 15:08:47 +0200 Subject: [PATCH] use getByID (also bad variable reference) --- classes/File_redirection.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/classes/File_redirection.php b/classes/File_redirection.php index 8a490fb18a..d1b266c90b 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(); -- 2.39.5