I have created an install profile that features node_gallery module. I try to install the site using drush site-install but it fails giving the following:


Starting Drupal installation. This takes a few seconds ...                                                                         [ok]
WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dbname.system' doesn't exist: SELECT name,          [error]
schema_version FROM {system} WHERE type = :type; Array
(
    [:type] => module
)
 in drupal_get_installed_schema_version() (line 155 of /path/to/drupal/includes/install.inc).
WD php: Warning: Cannot modify header information - headers already sent by (output started at                                       [warning]
/usr/share/php/drush/includes/output.inc:37) in drupal_send_headers() (line 1217 of
/path/to/sdrupal/includes/bootstrap.inc).
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dbname.system' doesn't exist: SELECT name, schema_version FROM {system} WHERE type = :type; Array
(
    [:type] => module
)
 in drupal_get_installed_schema_version() (line 155 of /path/to/drupal/includes/install.inc).
Drush command terminated abnormally due to an unrecoverable error.

If I remove node_gallery from the install profile the site builds without issue.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zengenuity’s picture

Priority: Major » Normal
Status: Active » Postponed (maintainer needs more info)

I have some idea why this might happen, but I'm not going to have time to look at this anytime soon. Let me point in the right direction, and if you can work out a fix, I will be glad to review your patch.

There's a series of things that happen in the hook_install() and hook_requirements() functions in the .install files for Node Gallery and Node Gallery API. (to create entity types and fields, detect D6 tables that need to be upgraded, etc.) It sounds like something may be written in such as way that it doesn't work during an install profile install. You should debug it from there to see what specifically is the problem.

Dante Blitz’s picture

I beilieve I have found the offending code.

It is in the node_gallery_api_requirements function in node_gallery_api.install...

  // Do not let this module be enabled if a D6 table schema exists.
  // Update.php must be run with this module disabled, and it will be enabled
  // as part of the upgrade process in node_gallery_update_7001().
  if ($phase === 'install') {
    $node_gallery_schema = drupal_get_installed_schema_version('node_gallery');
    $d6_table_exists = db_table_exists('node_gallery_images');
    if ($node_gallery_schema < 7000 && $d6_table_exists) {
      $requirements['node_gallery_upgrade'] = array(
        'description' => $t('Node Gallery API cannot be enabled because updates need to be run. With this module in place (but disabled), run <a href="!url">update.php</a>. Node Gallery API will be enabled as part of the upgrade path.', array('!url' => base_path() . 'update.php')),
        'severity' => REQUIREMENT_ERROR,
        'value' => NULL,
      );
    }
  }

It appears to be $node_gallery_schema = drupal_get_installed_schema_version('node_gallery'). My workaround is to simply comment out all the above code as I am not running a fresh D7 site.

zengenuity’s picture

Status: Postponed (maintainer needs more info) » Active
FileSize
1.59 KB

Okay, let's try checking for the D6 table first, then only getting the schema if that exists. Can you test this patch?

kenorb’s picture

Status: Active » Needs review