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.

CommentFileSizeAuthor
#1 1381410-use_drupal_load-1.patch411 bytesmakara

Comments

makara’s picture

Status: Active » Needs review
StatusFileSize
new411 bytes

The patch.

Status: Needs review » Needs work

The last submitted patch, 1381410-use_drupal_load-1.patch, failed testing.

makara’s picture

Does the test actually work?

misc’s picture

I 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.

makara’s picture

Too bad this patch breaks support to http://drupal.org/project/cache_backport. I'm trying to fix it.

misc’s picture

But is not Cache backport for Drupal 6?

makara’s picture

Yes, 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.

misc’s picture

Status: Needs work » Reviewed & tested by the community
misc’s picture

Status: Reviewed & tested by the community » Fixed

Commited to the latest dev.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.