We tried to install Hangouts on a PostgreSQL-based Drupal site and get the following error on install:

Notice: Undefined index: view files in user_role_grant_permissions() (line 3074 of /home/profilees/public_html/modules/user/user.module).
PDOException: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block: SELECT 1 AS expression FROM {role_permission} role_permission WHERE ( (rid = :db_condition_placeholder_0) AND (permission = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => view files ) in user_role_grant_permissions() (line 3076 of /home/profilees/public_html/modules/user/user.module).

From the PostgreSQL logs, I see this:

2013-06-13 12:15:06 EDT ERROR:  null value in column "module" violates not-null constraint
2013-06-13 12:15:06 EDT STATEMENT:  INSERT INTO role_permission (rid, permission, module) VALUES ('1', 'view files', NULL)
2013-06-13 12:15:06 EDT ERROR:  current transaction is aborted, commands ignored until end of transaction block
2013-06-13 12:15:06 EDT STATEMENT:  SELECT 1 AS expression
        FROM
        role_permission role_permission
        WHERE ( (rid = '1') AND (permission = 'view files') ) FOR UPDATE

I'm not sure what's going on with this. It looks like it's trying to give the 'view files' permission to role 1, and is failing. I'm not sure why this would come up on install of this module, as I see no .install file in the module.

Comments

Ben Coleman’s picture

Project: Hangouts » Debut Media
Version: 7.x-1.1 » 7.x-1.0

This turns out to be coming from the Debut Media module. I suspect this is something that MySQL may silently ignore, but PostgreSQL is typically more persnickety about. Seems that this comes up upon enabling any module after installing Debut Media.

Ben Coleman’s picture

Title: Can't install on PostgreSQL-based Drupal site » After installing Debut Media, other modules can't be activated

We've pulled Debut Media off of the original site. I installed it manually on a scratch Drupal 7/PostgreSQL site and got the following on install:

Notice: Trying to get property of non-object in debut_media_enable() (line 20 of /home/drupal7/public_html/sites/all/modules/debut_media/debut_media.install).
Warning: array_intersect_key() [function.array-intersect-key]: Argument #2 is not an array in debut_media_enable() (line 20 of /home/drupal7/public_html/sites/all/modules/debut_media/debut_media.install).
Warning: array_keys() expects parameter 1 to be array, null given in debut_media_enable() (line 20 of /home/drupal7/public_html/sites/all/modules/debut_media/debut_media.install).
Warning: Invalid argument supplied for foreach() in _features_restore() (line 866 of /home/drupal7/public_html/sites/all/modules/features/features.module).
Warning: Invalid argument supplied for foreach() in _features_restore() (line 866 of /home/drupal7/public_html/sites/all/modules/features/features.module).
Notice: Undefined index: view files in user_role_grant_permissions() (line 3074 of /home/drupal7/public_html/modules/user/user.module).
PDOException: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block: SELECT 1 AS expression FROM {role_permission} role_permission WHERE ( (rid = :db_condition_placeholder_0) AND (permission = :db_condition_placeholder_1) ) FOR UPDATE; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => view files ) in user_role_grant_permissions() (line 3076 of /home/drupal7/public_html/modules/user/user.module).

I do note that there are no Drupal Media permissions showing on the permissions page. Note that the last notice is pretty much identical to the one that came up on the original site. I so far can't reproduce the original problem, that after installing Debut media, I can't enable other modules, but I think the original site installed via the Apps mechanism. That may make a differennce.

Ben Coleman’s picture

Title: After installing Debut Media, other modules can't be activated » After installing Debut Media on a Drupal/PostgreSQL site, other modules can't be activated
nedjo’s picture

Thanks for the bug report. The relevant code forces creation of the feature's items at install time rather than the default Features behaviour of doing so on cache clear, which can trigger timeouts.

What's apparently happening here is that the feature_load() doesn't return the debut_media feature, leading to a series of further errors.

Likely the best fix - here and in all the other Debut features - is to test for the loaded feature before acting on it:

  if ($feature = feature_load($module)) {
    // Retain the order of component types, which is needed for example to ensure
    // that user roles are created ahead of user permissions that reference them.
    $items[$module] = array_keys(array_intersect_key(features_get_components(), $feature->info['features']));
    _features_restore('enable', $items);
    _features_restore('rebuild', $items);
  }
nedjo’s picture

Issue summary: View changes

Fix missing end > on first code block

nedjo’s picture

We can now remove the code that triggered this issue, since #1572578: Rethink the way features are enabled / disabled addressed the same need.

  • nedjo committed 6b32c61 on 7.x-1.x
    Issue #2018991: remove features enabling code, now handled by Features.
    
Ben Coleman’s picture

Status: Active » Closed (fixed)

This should have been closed with the commit.