system_listing

Versions
4.6 – 4.7
system_listing($mask, $directory, $key = 'name', $min_depth = 1)

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.

Parameters

$mask The 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.

▾ 3 functions call system_listing()

system_module_listing in modules/system.module
Generate a list of all the available modules, as well as update the system list.
system_theme_data in modules/system.module
Collect data about all currently available themes
xtemplate_templates in themes/engines/xtemplate/xtemplate.engine

Code

modules/system.module, line 402

<?php
function system_listing($mask, $directory, $key = 'name', $min_depth = 1) {
  $config = conf_init();
  $searchdir = array($directory);
  $files = array();

  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));
  }

  return $files;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.