From 1abe7372404a9d65f3b59eda2d83e628267b366d Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Sun, 19 Oct 2014 23:01:51 +0200 Subject: Clean up the postgres changes Style cleanup and some regression fixes Signed-off-by: Florian Pritz --- application/models/mfile.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'application/models') diff --git a/application/models/mfile.php b/application/models/mfile.php index be315b9e6..539092887 100644 --- a/application/models/mfile.php +++ b/application/models/mfile.php @@ -219,15 +219,17 @@ class Mfile extends CI_Model { // which is actually done by a SQL contraint. // TODO: make it work properly without the constraint $map = $this->db->select('multipaste_id') + ->distinct() ->from('multipaste_file_map') ->where('file_url_id', $id) - ->get()->row_array(); + ->get()->result_array(); $this->db->where('id', $id) ->delete('files'); - if ( ! empty($map['multipaste_id'])) { - $this->db->where('multipaste_id', $map['multipaste_id']) + foreach ($map as $entry) { + assert(!empty($entry['multipaste_id'])); + $this->db->where('multipaste_id', $entry['multipaste_id']) ->delete('multipaste'); } @@ -264,15 +266,17 @@ class Mfile extends CI_Model { } $map = $this->db->select('multipaste_id') + ->distinct() ->from('multipaste_file_map') ->where('file_url_id', $file['id']) - ->get()->row_array(); + ->get()->result_array(); $this->db->where('hash', $hash) ->delete('files'); - if ( ! empty($map['multipaste_id'])) { - $this->db->where('multipaste_id', $map['multipaste_id']) + foreach ($map as $entry) { + assert(!empty($entry['multipaste_id'])); + $this->db->where('multipaste_id', $entry['multipaste_id']) ->delete('multipaste'); } -- cgit v1.2.3-24-g4f1b