From 8c43c5bd16b59eb510076edce828468c1940629a Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 3 Nov 2014 18:17:15 +0100 Subject: 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 --- application/models/mfile.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'application/models') 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)) { -- cgit v1.2.3-24-g4f1b