diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-10-19 23:01:51 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-10-19 23:01:51 +0200 |
commit | 1abe7372404a9d65f3b59eda2d83e628267b366d (patch) | |
tree | e9820b18cb65240bb9549b5ed7ac78cc1d6cc59d /application/models/mfile.php | |
parent | dbb2247b82ab49c50f424c904ac98702507f1a8e (diff) |
Clean up the postgres changes
Style cleanup and some regression fixes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models/mfile.php')
-rw-r--r-- | application/models/mfile.php | 16 |
1 files changed, 10 insertions, 6 deletions
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'); } |