Requiring the user to install something to Drupal's docroot is obnoxious (think what would happen if more modules required this) and should be avoided if possible.

Here's a patch that allows me to run chatroomread.php straight from the module directory. I have tested this only with Lighttpd, so I would appreciate if anyone could test it with Apache. The code to determine the Drupal root is a little ugly, but it's the best I could come up with that's both safe (no passing of the directory name through the script) and works whether Drupal is installed right under the docroot or under a subdir.

Comments

Peter Bex’s picture

By the way, the way the directory is searched is not 100% foolproof since one could install Drupal in a directory under a deployment of another application that also happens to have an includes/bootstrap.inc file (possibly Drupal installed in a subdirectory of another Drupal), but I think it's safe to say that that's highly unlikely. It could be mentioned in the README, if it's a big deal.

Peter Bex’s picture

StatusFileSize
new3.05 KB

Here's an improvement that fixes a problem with the chat cache directory.

Anonymous’s picture

Status: Needs review » Closed (won't fix)

thanks, but i'm going to wont-fix this.

i'm not going to add this extra code to walk back from the chatroom module dir and look for 'includes/bootstrap.inc'. that in no way guarantees that you've found the base of the drupal install. following another suggestion, i'm going to add some code that detects if the module is enabled but chatroomread.php is not in the webroot, and put up a warning.

ElgarL’s picture

I was just reading over this and thought of a way to do it.

on module install (just after the checks on the file/directory), create a $global and set it to - dirname($_SERVER['SCRIPT_FILENAME'])

That will be the root install of drupal on that machine for that website. Perhaps add a number to differentiate between multisites. That way you can do as the other user suggested and perform a chdir to the root while keeping the php script IN the chatroom directory.

It also gets around your probale about people installign in odd locations for modules as the path will come direct from Drupal.

bagusflyer’s picture

I just install chatroom 6.x-2.14 in drupal 6.20, but I got the same problem. What should I do? Thanks