diff --git a/src/IDF/IssueFile.php b/src/IDF/IssueFile.php index f0745e8..12b6375 100644 --- a/src/IDF/IssueFile.php +++ b/src/IDF/IssueFile.php @@ -123,4 +123,9 @@ class IDF_IssueFile extends Pluf_Model } $this->modif_dtime = gmdate('Y-m-d H:i:s'); } + + function preDelete() + { + @unlink(Pluf::f('upload_issue_path').'/'.$this->attachment); + } } diff --git a/src/IDF/Project.php b/src/IDF/Project.php index 06960d4..bee4372 100644 --- a/src/IDF/Project.php +++ b/src/IDF/Project.php @@ -541,4 +541,20 @@ class IDF_Project extends Pluf_Model Pluf_Signal::send('IDF_Project::created', 'IDF_Project', $params); } + + /** + * The delete() call do not like circular references and the + * IDF_Tag is creating some. We predelete to solve these issues. + */ + public function preDelete() + { + $what = array('IDF_Upload', 'IDF_Review', 'IDF_Issue', + 'IDF_WikiPage', 'IDF_Commit', + ); + foreach ($what as $m) { + foreach (Pluf::factory($m)->getList(array('filter' => 'project='.(int)$this->id)) as $item) { + $item->delete(); + } + } + } } diff --git a/src/IDF/Upload.php b/src/IDF/Upload.php index 031552f..24fe3a9 100644 --- a/src/IDF/Upload.php +++ b/src/IDF/Upload.php @@ -160,6 +160,7 @@ class IDF_Upload extends Pluf_Model function preDelete() { IDF_Timeline::remove($this); + @unlink(Pluf::f('upload_path').'/'.$this->project->shortname.'/files/'.$this->file); } /**