Fixed issue 183, project can not be deleted because of foreign key integrity constraints.
This commit is contained in:
parent
b9773b555c
commit
1656c99a48
@ -123,4 +123,9 @@ class IDF_IssueFile extends Pluf_Model
|
|||||||
}
|
}
|
||||||
$this->modif_dtime = gmdate('Y-m-d H:i:s');
|
$this->modif_dtime = gmdate('Y-m-d H:i:s');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preDelete()
|
||||||
|
{
|
||||||
|
@unlink(Pluf::f('upload_issue_path').'/'.$this->attachment);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -541,4 +541,20 @@ class IDF_Project extends Pluf_Model
|
|||||||
Pluf_Signal::send('IDF_Project::created',
|
Pluf_Signal::send('IDF_Project::created',
|
||||||
'IDF_Project', $params);
|
'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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,7 @@ class IDF_Upload extends Pluf_Model
|
|||||||
function preDelete()
|
function preDelete()
|
||||||
{
|
{
|
||||||
IDF_Timeline::remove($this);
|
IDF_Timeline::remove($this);
|
||||||
|
@unlink(Pluf::f('upload_path').'/'.$this->project->shortname.'/files/'.$this->file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user