function views1_delete

Delete a version 1 view from the database.

1 call to views1_delete()
views_ui_delete1_confirm_submit in includes/convert.inc
Submit handler to delete a view.

File

includes/convert.inc, line 556

Code

function views1_delete($arg) {
    static $cache = array();
    $where = is_numeric($arg) ? "v.vid =  %d" : "v.name = '%s'";
    $view = db_fetch_object(db_query("SELECT v.* FROM {view_view} v WHERE {$where}", $arg));
    if (!$view->name) {
        return NULL;
    }
    $result = db_query("DELETE FROM {view_sort} WHERE vid = {$view->vid}");
    $result = db_query("DELETE FROM {view_argument} WHERE vid = {$view->vid}");
    $result = db_query("DELETE FROM {view_tablefield} WHERE vid = {$view->vid}");
    $result = db_query("DELETE FROM {view_filter} WHERE vid = {$view->vid}");
    $result = db_query("DELETE FROM {view_exposed_filter} WHERE vid = {$view->vid}");
    $result = db_query("DELETE FROM {view_view} WHERE vid = {$view->vid}");
}