In nodequeue_save() we have the code:
if (function_exists('views_invalidate_cache')) {
views_invalidate_cache();
}
That will lead to errors when these conditions are met:
* Your site uses both nodequeue and views.
* One of your modules depend on nodequeue but not on views (also no indirect dependency).
* That module implements a DrupalWebTestCase.
* The test case will now fail.
Why?
The function_exists('views_invalidate_cache') call will return TRUE because your system has views enabled and hence views_invalidate_cache() will be executed. But views_invalidate_cache() will fail because it expects the database table {cache_views} to be present. The {cache_views} table will not be present when executing the test case because the test case uses a prefixed database and since the test case has not installed views there is no {cache_views} in the prefixed database.
If we use module_exists('views') instead we get the correct behaviour because test cases rebuilds the list of enabled modules.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | nodequeue-module-exists-1984026-1.patch | 377 bytes | arnested |
Comments
Comment #1
arnested commentedComment #2
arnested commentedThere is a number of other usages of function_exists() in nodequeue.module (and one i nodequeue_generate.module) but they all rely on function names derived from $queue->owner.
I think we can assume those to work unless someone has implemented really obscure usages of nodequeues.
Comment #3
gielfeldt commentedI haven't investigated this, but if the function_exists() is used because of compatibility between the nodequeue module and different versions of views, then there should probably be a check for both module_exists() and function_exists().
Comment #4
arnested commentedGood point, @gielfeldt.
views_invalidate_cache() has been in views at least since October 2009 (as far back as I can see in git) so I don't think we need to check with both module_exists() and function_exists() in this case.
Comment #6
fizk commentedCommitted. Thanks!