function view::delete in Views (for Drupal 7) 6.2
Same name and namespace in other branches
- 6.3 includes/view.inc \view::delete()
- 7.3 includes/view.inc \view::delete()
Delete the view from the database.
File
Class
- view
- An object to contain all of the data to generate a view, plus the member functions to build the view query, execute the query and render the output.
Code
function delete($clear = TRUE) {
if (empty($this->vid)) {
return;
}
db_query("DELETE FROM {views_view} WHERE vid = %d", $this->vid);
// Delete from all of our subtables as well.
foreach ($this
->db_objects() as $key) {
db_query("DELETE from {views_" . $key . "} WHERE vid = %d", $this->vid);
}
cache_clear_all('views_query:' . $this->name, 'cache_views');
if ($clear) {
cache_clear_all();
// this clears the block and page caches only.
menu_rebuild();
// force a menu rebuild when a view is deleted.
}
}