As determined in #1808200-15: Unit test performance significantly decreased since system list config conversion:

change the entire function signature; first and foremost to remove the DRUPAL_PHP_FUNCTION_PATTERN from all callers and just have $dir and $extension, and only optionally $min_depth and $key in there

i.e., the resulting signature should look like this:

# The 99.9% use-case:
$modules = drupal_system_listing('modules');
$themes = drupal_system_listing('themes');
$profiles = drupal_system_listing('profiles');

# But still allow to override default parameters:
$modules = drupal_system_listing('modules', '.module', 0, 'uri');

$libraries = drupal_system_listing('libraries', '.info', 1, 'filename');

Additionally, consider to add a generic helper function to bootstrap.inc that returns a simple mapping array for core-supported directory names and file extensions — since this mapping is apparently repeated in drupal_get_filename().

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sun’s picture

Status: Postponed » Active
sun’s picture

Status: Active » Needs review
FileSize
10.95 KB

This is what I had in mind.

Turns out that this allows us to simplify drupal_get_filename() and simpletest_classloader_register() already, so I'm no longer sure whether we need to factor out the mapping.

sun’s picture

Fixed typos.

The last submitted patch, drupal8.system-listing.3.patch, failed testing.

Anonymous’s picture

Issue summary: View changes

Updated issue summary.

sun’s picture

Issue summary: View changes
Status: Needs work » Closed (duplicate)