mongodb_cache.inc can be used as a library (loads in settings.php) and doesn't need to be inside Drupal path. But then if people still want to enable Mongodb module, it ends up with including a same mongodb.module file from different locations.
I propose changing the line
include_once dirname(__FILE__) . '/../mongodb.module';
to
if (!drupal_load('module', 'mongodb')) {
include_once dirname(__FILE__) . '/../mongodb.module';
}
The other advantages would be that drupal_load() will find the right location and prevent duplicate include_once.
I'll upload a patch.
There are more include_once in other sub-modules, mongodb_session and mongodb_watchdog. I think it would be better to use drupal_load when it's possible.
Comments
Comment #1
makara commentedThe patch.
Comment #3
makara commentedDoes the test actually work?
Comment #4
misc commentedI do not think the test does work - I think it is because of the test-requirement to have mongodb installed on the server and the testing server does not have it.
Comment #5
makara commentedToo bad this patch breaks support to http://drupal.org/project/cache_backport. I'm trying to fix it.
Comment #6
misc commentedBut is not Cache backport for Drupal 6?
Comment #7
makara commentedYes, with Cache backport module, you can use the cache modules made for Drupal 7 with Drupal 6, and you can use different cache backends with different bins. Pretty useful.
Comment #8
misc commentedComment #9
misc commentedCommited to the latest dev.