--- includes/common.inc +++ includes/common.inc @@ -5084,6 +5088,36 @@ function drupal_cron_cleanup() { } /** + * recusive function to find listing paths from profiles and thier parents + * + * @param string $profile + * the name of the profile to search + * @param string $directory + * The subdirectory name in which the files are found. For example, + * 'modules' will search in sub-directories of the top-level /modules + * directory, sub-directories of /sites/all/modules/, etc. + * @param array $searchdir + * the searchdir already found and to which to add before returning + * + * @return array + * an array of paths that should be searched. Starting with param $searchdir and any + * items added from the profile and parents + */ +function drupal_system_listing_profile($profile, $directory, $searchdir = array()) { + $info = drupal_parse_info_file("profiles/$profile/$profile.info"); + if(isset($info['parents'])) { + foreach($info['parents'] as $parent) { + $searchdir = drupal_system_listing_profile($parent, $directory, $searchdir); + } + } + if (file_exists("profiles/$profile/$directory")) { + $searchdir[] = "profiles/$profile/$directory"; + } + + return $searchdir; +} + +/** * Returns information about system object files (modules, themes, etc.). * * This function is used to find all or some system object files (module files, @@ -5143,9 +5177,7 @@ function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1) // themes as organized by a distribution. It is pristine in the same way // that /modules is pristine for core; users should avoid changing anything // there in favor of sites/all or sites/ directories. - if (file_exists("profiles/$profile/$directory")) { - $searchdir[] = "profiles/$profile/$directory"; - } + $searchdir = drupal_system_listing_profile($profile, $directory, $searchdir); // Always search sites/all/* as well as the global directories $searchdir[] = 'sites/all/' . $directory;