From 1f82daace2cf998d6af8bcdbfc8f11046a285bf3 Mon Sep 17 00:00:00 2001 From: Adam J. DiCarlo Date: Tue, 11 Oct 2011 11:16:46 -0700 Subject: [PATCH] Issue #1179420 by adamdicarlo: Unable to install Bean Admin UI from an installation profile. --- bean_admin_ui/bean_admin_ui.module | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/bean_admin_ui/bean_admin_ui.module b/bean_admin_ui/bean_admin_ui.module index 62e781e..a237b4a 100644 --- a/bean_admin_ui/bean_admin_ui.module +++ b/bean_admin_ui/bean_admin_ui.module @@ -106,9 +106,19 @@ function bean_admin_ui_get_types() { if (empty($bean_types)) { $cache = cache_get('bean_types'); if (empty($cache->data)) { - ctools_include('export'); - $bean_types = ctools_export_load_object('bean_type'); - cache_set('bean_types', $bean_types); + // In install profiles, this function can get called before Drupal's created + // our database tables (see http://drupal.org/node/1179420), so don't crash + // Drupal installation by trying to get bean types; if we did, we'd query a + // nonexistent table. + if (defined('MAINTENANCE_MODE') && MAINTENANCE_MODE == 'install' && + drupal_get_installed_schema_version('bean_admin_ui', TRUE) == SCHEMA_UNINSTALLED) { + $bean_types = array(); + } + else { + ctools_include('export'); + $bean_types = ctools_export_load_object('bean_type'); + cache_set('bean_types', $bean_types); + } } else { $bean_types = $cache->data; -- 1.7.4.1