Commit 21c12b6c authored by Nigel McNie's avatar Nigel McNie
Browse files

Properly delete blockinstances when deleting a View, this ensures that the...

Properly delete blockinstances when deleting a View, this ensures that the delete hooks are called properly (and thus extra data is removed from blocktype tables).

Also wrap view deletion in a transaction.
parent 6527a7e7
......@@ -261,17 +261,23 @@ class View {
public function delete() {
db_begin();
delete_records('artefact_feedback','view',$this->id);
delete_records('view_feedback','view',$this->id);
delete_records('view_artefact','view',$this->id);
delete_records('view_access','view',$this->id);
delete_records('view_access_group','view',$this->id);
delete_records('view_access_usr','view',$this->id);
delete_records('view_tag','view',$this->id);
delete_records('usr_watchlist_view','view',$this->id);
delete_records('block_instance', 'view', $this->id);
if ($blockinstanceids = get_column('block_instance', 'id', 'view', $this->id)) {
foreach ($blockinstanceids as $id) {
$bi = new BlockInstance($id);
$bi->delete();
}
}
delete_records('view','id',$this->id);
$this->deleted = true;
db_commit();
}
public function get_access() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment