drupal_system_listing

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/common.inc, строка 2714

Версии
5 – 6
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, 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 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.

Параметры

$mask Регулярное выражение для поиска файлов.

$directory Имя поддиректории, в которой искать файлы. Например, при 'modules' поиск будет производиться и в modules/, и в sites/somesite/modules/.

$key Ключ для передачи в file_scan_directory().

$min_depth Минимальная вложенность директорий, с которой возвращать файлы.

Возвращаемое значение

Массив файловых объектов указанного типа.

▾ 5 функции вызывают drupal_system_listing()

drupal_find_theme_templates in includes/theme.inc
Find overridden theme templates. Called by themes and/or theme engines to easily discover templates.
drupal_get_install_files in includes/install.inc
Получает список всех ".install" файлов.
drupal_verify_profile in includes/install.inc
Verify a profile for installation.
module_rebuild_cache in includes/module.inc
Обновляет кеш файлов модулей.
_system_theme_data in modules/system/system.module
Helper function to scan and collect theme .info data and their engines.

Код

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

  // When this function is called during Drupal's initial installation process,
  // the name of the profile that's about to be installed is stored in the global
  // $profile variable. At all other times, the standard Drupal systems variable
  // table contains the name of the current profile, and we can call variable_get()
  // to determine what one is active.
  if (!isset($profile)) {
    $profile = variable_get('install_profile', 'default');
  }
  $searchdir = array($directory);
  $files = array();

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

  // 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";
  }

  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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему