? systemdirs.patch Index: modules/system.module =================================================================== RCS file: /cvs/drupal/drupal/modules/system.module,v retrieving revision 1.215 diff -u -r1.215 system.module --- modules/system.module 21 Jun 2005 09:45:45 -0000 1.215 +++ modules/system.module 24 Jun 2005 23:50:13 -0000 @@ -368,11 +368,14 @@ /** * Returns an array of files objects of the given type from both the * site-wide directory (i.e. modules/) and site-specific directory - * (i.e. sites/somesite/modules/). The returned array will be keyed - * using the key specified (name, basename, filename). Using name or - * basename will cause site-specific files to shadow files in the - * default directories. That is, if a file with the same name appears - * in both location, only the site-specific version will be included. + * (i.e. sites/somesite/modules/). Optionally, the global variable + * $system_dirs can be set to an additional array of paths to search. + * The order they will be searched is site-wide, admin configured and + * then site-specific. The returned array will be keyed using the key + * specified (name, basename, filename). Using name or basename will + * cause site-specific files to shadow files in the default directories. + * That is, if a file with the same name appears in both location, + * only the site-specific version will be included. * * @param $mask * The regular expression of the files to find. @@ -389,14 +392,26 @@ * An array of file objects of the specified type. */ function system_listing($mask, $directory, $key = 'name', $min_depth = 1) { + global $system_dirs; + $config = conf_init(); $searchdir = array($directory); $files = array(); + if (is_array($system_dirs)) { + foreach ($systems_dirs as $dir) { + if (file_exists("$dir/$directory")) { + $searchdir[] = "$dir/$directory"; + } + } + } + if (file_exists("$config/$directory")) { $searchdir[] = "$config/$directory"; } + + // Get current list of items foreach ($searchdir as $dir) { $files = array_merge($files, file_scan_directory($dir, $mask, array('.', '..', 'CVS'), 0, TRUE, $key, $min_depth));