Right now - alomst every place we are including a file we have to concat DRUPAL_ROOT.
It would be much better if this was just included at a lower level in drupal_system_listing(), etc.
possible like:
index fc8acd1..853547d 100644
--- includes/common.inc
+++ includes/common.inc
@@ -3740,7 +3740,7 @@ function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1)
// Get current list of items
foreach ($searchdir as $dir) {
- $files = array_merge($files, file_scan_directory($dir, $mask, array('key' => $key, 'min_depth' => $min_depth)));
+ $files = array_merge($files, file_scan_directory(DRUPAL_ROOT . '/' . $dir, $mask, array('key' => $key, 'min_depth' => $min_depth)));
}
Comments
Comment #1
gaelicWizard commented+q
Comment #2
zroger commentedChanging this to a bug report. When bootstrapping Drupal from outside of
DRUPAL_ROOT, the relative paths to the search directories cause nothing to be found.Here's a script to reproduce:
Put this script in the parent directory of your Drupal root. My drupal root in this test is named
drupal-7. Running it from that same directory gives me the following output.I personally consider this a bug with
drupal_system_listing, since from what I understandDRUPAL_ROOTwas introduced to eliminate any dependency on the current working directory. If this is not a bug, then at a minimum the docs fordrupal_bootstrapshould be updated to include changing directories before bootstrapping.Comment #3
cameron tod commentedFor reference, here's the original issue where system_listing was replaced with drupal_system_listing : http://drupal.org/node/88287
And where DRUPAL_ROOT was added: http://drupal.org/node/259623
Comment #4
cameron tod commentedpwolainin, by putting DRUPAL_ROOT into drupal_system_listing(), how do you propose changing the way files are included?
I'm seeing 238 uses of the `require_once DRUPAL_ROOT . '/file.inc'` approach with a
egrep -rn "(include_once|require_once) DRUPAL_ROOT" . | grep -v "*" | wc -lon the 7.x branch.