The view unpublished module has a conflict with the latest version of the file_entity module.
This is because the view_unpublished_query_alter() function is not specific enough in what it alters and it alters and breaks the file entity listing sql.
To reproduce, go to admin/content/files, with an admin that is allowed to see it (not user 1) and you get the message:
"The website encountered an unexpected error. Please try again later."
And this error:
PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'n.type' in 'where clause': SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {file_managed} f INNER JOIN {users} u ON f.uid = u.uid WHERE (f.status = :db_condition_placeholder_0) AND (f.uri NOT LIKE :db_condition_placeholder_1 ESCAPE '\\') AND( (n.type = :db_condition_placeholder_2) OR (n.type = :db_condition_placeholder_3) OR (n.type = :db_condition_placeholder_4) OR (n.type = :db_condition_placeholder_5) OR (n.type = :db_condition_placeholder_6) )) subquery; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => temporary% [:db_condition_placeholder_2] => case_studies [:db_condition_placeholder_3] => documents [:db_condition_placeholder_4] => individual_board_committees [:db_condition_placeholder_5] => page [:db_condition_placeholder_6] => profile ) in PagerDefault->execute() (line 74 of /home/mysite/public_html/includes/pager.inc).
The code that generates the original query that is being altered is in the file entity module in file_entity_admin_files().
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | view_unpublished.code_.1857656-8.patch | 607 bytes | larowlan |
| #6 | view_unpublished-node_access_query_alter-1857656-6.patch | 799 bytes | yang_yi_cn |
| #4 | view_unpublished-node_access_query_alter-1857656-4.patch | 607 bytes | rooby |
Comments
Comment #1
rooby commentedI've tracked this down to the view_unpublished module being a little to generic in its hook_query_alter() implementation.
Comment #2
rooby commentedOops, wrong project.
Comment #2.0
rooby commentedTweak to the error message.
Comment #3
rooby commentedFor a fix the code in view_unpublished_query_alter() should probably be in view_unpublished_query_node_access_alter() instead.
Comment #4
rooby commentedHere is a patch that makes the change mentioned in #3.
Comment #5
highfellow commentedJust confirming that this patch worked for me. Thanks.
Comment #6
yang_yi_cn commented#4 does't apply cleanly. I re-rolled it.
Comment #7
larowlan+1 for patch 4
Comment #8
larowlanRe-roll without the duplication and whitespace
Comment #9
genjohnson commentedI applied the patch in 8 (manually) and it worked for me. Thank you!
Comment #9.0
genjohnson commentedUpdating the description to better describe the problem.
Comment #10
reubenavery commentedLooks good, someone please commit!
Comment #11
nathan.bolin commentedI applied the patch in 8 (manually) and it worked for me.
It took a little digging before I found the error, and the solution here.
My error was found by an editor on a production site, where logging was disabled for performance. Only editors encountered an error message when trying to access /admin/content/files. The good ol' generic "website encountered an unexpected error".
Users with the administrator role were able to access the page, no problem.
Thanks!
Comment #13
entendu commentedThanks for the patch!