drupal_system_listing

Versions
mediamosa-21
drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1)

Return an array of system file objects.

Returns an array of file objects of the given type from the site-wide directory (i.e. modules/), the all-sites directory (i.e. sites/all/modules/), the profiles directory (i.e. profiles/your_site_profile/modules/), and the site-specific directory (i.e. sites/your_site_dir/modules/). The returned array will be keyed using the key specified (uri, filename, or name). Using name or filename will cause site-specific files to be prioritized over similar files in the default directories. That is, if a file with the same name appears in both the site-wide directory and site-specific directory, only the site-specific version will be included.

Parameters

$mask The preg_match() regular expression of the files to find.

$directory The subdirectory name in which the files are found. For example, 'modules' will search in both modules/ and sites/somesite/modules/.

$key The key to be passed to file_scan_directory().

$min_depth Minimum depth of directories to return files from.

Return value

An array of file objects of the specified type.

▾ 10 functions call drupal_system_listing()

coder_review_page_form in sites/all/modules/coder/coder_review/coder_review.module
Implements hook_form().
coder_review_reviews in sites/all/modules/coder/coder_review/coder_review.module
Implements hook_reviews().
coder_upgrade_upgrades in sites/all/modules/coder/coder_upgrade/conversions/coder_upgrade.main.inc
Implement hook_upgrades().
drupal_find_theme_templates in includes/theme.inc
Allow themes and/or theme engines to easily discover overridden templates.
drupal_get_filename in includes/bootstrap.inc
Returns and optionally sets the filename for a system item (module, theme, etc.). The filename, whether provided, cached, or retrieved from the database, is only returned if the file exists.
drupal_required_modules in includes/module.inc
Array of modules required by core.
drupal_verify_profile in includes/install.inc
Verify an install profile for installation.
_coder_review_modified in sites/all/modules/coder/coder_review/coder_review.module
Return last modification timestamp of coder_review and all of its dependencies.
_system_rebuild_module_data in modules/system/system.module
Helper function to scan and collect module .info data.
_system_rebuild_theme_data in modules/system/system.module
Helper function to scan and collect theme .info data and their engines.

Code

includes/common.inc, line 4507

<?php
function drupal_system_listing($mask, $directory, $key = 'name', $min_depth = 1) {
  $config = conf_path();

  $profile = drupal_get_profile();

  $searchdir = array($directory);
  $files = array();

  // The 'profiles' directory contains pristine collections of modules and
  // 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/<domain> directories.
  if (file_exists("profiles/$profile/$directory")) {
    $searchdir[] = "profiles/$profile/$directory";
  }

  // Always search sites/all/* as well as the global directories
  $searchdir[] = 'sites/all/' . $directory;

  if (file_exists("$config/$directory")) {
    $searchdir[] = "$config/$directory";
  }

  // Get current list of items
  if (!function_exists('file_scan_directory')) {
    require_once DRUPAL_ROOT . '/includes/file.inc';
  }
  foreach ($searchdir as $dir) {
    $files = array_merge($files, file_scan_directory($dir, $mask, array('key' => $key, 'min_depth' => $min_depth)));
  }

  return $files;
}
?>