diff options
author | Florian Pritz <bluewind@xinu.at> | 2014-11-03 18:17:15 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2014-11-03 18:17:15 +0100 |
commit | 8c43c5bd16b59eb510076edce828468c1940629a (patch) | |
tree | 2e7c32a9aad6f24a51f6020ee315a0ce12735ba8 /application/models/mfile.php | |
parent | a485be040550c777e6fb055762d081eb85f1c670 (diff) |
Properly delete multipastes when deleting a single paste
mmultipaste->delete_id() also deletes multipaste tarballs which would
otherwise be left over
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models/mfile.php')
-rw-r--r-- | application/models/mfile.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/application/models/mfile.php b/application/models/mfile.php index 539092887..8a514c292 100644 --- a/application/models/mfile.php +++ b/application/models/mfile.php @@ -218,9 +218,10 @@ class Mfile extends CI_Model { // Note that this does not delete all relations in multipaste_file_map // which is actually done by a SQL contraint. // TODO: make it work properly without the constraint - $map = $this->db->select('multipaste_id') + $map = $this->db->select('url_id') ->distinct() ->from('multipaste_file_map') + ->join("multipaste", "multipaste.multipaste_id = multipaste_file_map.multipaste_id") ->where('file_url_id', $id) ->get()->result_array(); @@ -228,9 +229,8 @@ class Mfile extends CI_Model { ->delete('files'); foreach ($map as $entry) { - assert(!empty($entry['multipaste_id'])); - $this->db->where('multipaste_id', $entry['multipaste_id']) - ->delete('multipaste'); + assert(!empty($entry['url_id'])); + $this->mmultipaste->delete_id($entry["url_id"]); } if ($this->id_exists($id)) { |