I just attempted to install the feeds: file module which includes this module as a dependency. I used drush to perform the install:
drush dl feeds_file
This prompted to download this file_entity module. I then executed
drush en feeds_file
which enabled both feeds_file and file_entity. I then executed
drush updb and got these results
The following updates are pending:
file_entity module :
7101 - Update all files with empty types to use the first part of filemime. For example, an png image with filemime 'imagepng' will be assigned a file type of 'image'.
7102 - Empty update function to trigger an entity cache rebuild.
7103 - Empty update function.
7104 - Assign view file permission when updating without the Media module.
7200 - Create the {image_dimensions} database table.
7201 - Add the {file_type}, {file_type_mimetypes} and {file_type_streams} tables.
7202 - Drupal 7.8 disallows empty string as the value for a bundle key, so update empty {file_managed}.type records to 'undefined' instead.
7203 - Update permission names.
7204 - Add title and alt text to image file types.
Do you wish to run all pending updates? (y/n): y
Performed update: file_entity_update_7101 [ok]
Performed update: file_entity_update_7102 [ok]
Performed update: file_entity_update_7103 [ok]
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'module' cannot be null [error]
Performed update: file_entity_update_7104 [ok]
Finished performing updates.
I do not have the media module installed in this Drupal instance. So there is no conflict possible with that module. After getting this error. I did attempt to use the update.php feature through the browser in case it made a difference. However, I got the same integrity constraint violation error.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | manually-add-role-permissions-1961466-10.patch | 807 bytes | devin carlson |
| #6 | manually-add-role-permissions-1961466-6.patch | 808 bytes | devin carlson |
Comments
Comment #1
jlk4p commentedNOTE: I created a new Drupal site installation and installed the file_entity module first and then installed the feeds_file module and did not see this error in that instance. I did previously have the media module installed on the other Drupal instance but I had disabled it, uninstalled it, and deleted its directory. I'm wondering if some remnants of the media module caused the file_entity module to fail installation.
Comment #2
mrP commentedIts actually a problem with the user_role_grant_permissions() function in Drupal core -- see #737816: user_role_grant_permissions() throws PDOException when used with non-existent permissions (e.g. a permission for a disabled/uninstalled module). There is a patch for D7.22 in the same issue at comment #34.
One really easy workaround that doesn't involve patching core is to enable the media module since file_entity_update_7104 only has to do something
if (!module_exists('media'))Comment #3
jlk4p commentedThank you for this explanation. I have applied the recommended patch to avoid this issue in the future.
Comment #4
vacilando commentedI have downloaded a fresh 7.x-2.0-alpha2, ran drush updatedb and got this error. Means file_entity_update_7104 has not executed nor any subsequent updates (currently through to file_entity_update_7215).
Seems like this needs solving, so setting this back to active state.
NB:
Running on Drupal 7.23.
Switching the Media module on to fix this is not a solution unless File Entity depended on Media.
Comment #5
mrP commentedYeah, it could use some work.
file_entity_update_7104should probably have a check to make sure that the 'view file' permission actually exists before trying to grant it.I'm guessing in your case it doesn't.
Comment #6
devin carlson commentedThis update hook was introduced in #1290634: Install view file permission to all roles by default.
Drupal core doesn't seem to use
user_role_grant_permission()for the reasons outlined in this issue (a module could be disabled or the permissions could be renamed or removed).It seems that manually altering the database is recommended, such as done in
contact_update_7002(). The attached patch changes the update to add the role permissions manually.Comment #7
devin carlson commented#6: manually-add-role-permissions-1961466-6.patch queued for re-testing.
Comment #9
devin carlson commented#6: manually-add-role-permissions-1961466-6.patch queued for re-testing.
Comment #10
devin carlson commentedThe update should probably do a merge à la
contact_update_7002()just in case the permission already exists.Comment #11
devin carlson commentedCommitted #10 to File entity 7.x-2.x.
http://drupalcode.org/project/file_entity.git/commit/3e0c819