Index: contrib/views.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/install_profile_api/contrib/Attic/views.inc,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 views.inc
--- contrib/views.inc	14 Jul 2009 18:21:16 -0000	1.1.2.4
+++ contrib/views.inc	11 Aug 2009 17:06:47 -0000
@@ -35,3 +35,24 @@ function install_views_ui_import_from_fi
   // Remove this view from cache so we can edit it properly.
   views_object_cache_clear('view', $form_state['view']->name);
 }
+
+/**
+ * Disables a view by name.
+ * 
+ * @param $name
+ *  The name of the view to disable.
+ * @param $rebuild_menu
+ *  The menu tree must be rebuilt after install_views_disable_view() is
+ *  called, however when called many times in a row it may be sensible
+ *  to only rebuild the menu tree once at the end.
+ **/
+function install_views_disable_view($name, $rebuild_menu = TRUE) {
+  $views_status = variable_get('views_defaults', array());
+  $views_status[$name] = TRUE; // True is disabled
+  variable_set('views_defaults', $views_status);
+  views_invalidate_cache();
+
+  if ($rebuild_menu) {
+    menu_rebuild();
+  }
+}
