Download & Extend

Use drupal_load() when it's possible

Project:Mongodb
Version:7.x-1.x-dev
Component:Miscellaneous
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

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

<?php
include_once dirname(__FILE__) . '/../mongodb.module';
?>

to

<?php
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

#1

Status:active» needs review

The patch.

AttachmentSizeStatusTest resultOperations
1381410-use_drupal_load-1.patch411 bytesIdleFAILED: [[SimpleTest]]: [MySQL] 195 pass(es), 4 fail(s), and 0 exception(es).View details

#2

Status:needs review» needs work

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

#3

Does the test actually work?

#4

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.

#5

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

#6

But is not Cache backport for Drupal 6?

#7

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.

#8

Status:needs work» reviewed & tested by the community

#9

Status:reviewed & tested by the community» fixed

Commited to the latest dev.

#10

Status:fixed» closed (fixed)

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

nobody click here