RecursiveExtensionFilterIterator

Filters a RecursiveDirectoryIterator to discover extensions.

To ensure the best possible performance for extension discovery, this filter implementation hard-codes a range of assumptions about directories in which Drupal extensions may appear and in which not. Every unnecessary subdirectory tree recursion is avoided.

The list of globally ignored directory names is defined in the RecursiveExtensionFilterIterator::$blacklist property.

In addition, all 'config' directories are skipped, unless the directory path ends with 'modules/config', so as to still find the config module provided by Drupal core and still allow that module to be overridden with a custom config module.

Lastly, ExtensionDiscovery instructs this filter to additionally skip all 'tests' directories at regular runtime, since just with Drupal core only, the discovery process yields 4x more extensions when tests are not ignored.

@todo Use RecursiveCallbackFilterIterator instead of the $acceptTests parameter forwarding once PHP 5.4 is available.

Hierarchy

See also

ExtensionDiscovery::scan()

ExtensionDiscovery::scanDirectory()

File

core/lib/Drupal/Core/Extension/Discovery/RecursiveExtensionFilterIterator.php, line 31

Namespace

Drupal\Core\Extension\Discovery

Members

Name Modifiers Type Description
RecursiveExtensionFilterIterator::$acceptTests protected property Whether to include test directories when recursing.
RecursiveExtensionFilterIterator::$blacklist protected property List of directory names to skip when recursing.
RecursiveExtensionFilterIterator::$whitelist protected property List of base extension type directory names to scan.
RecursiveExtensionFilterIterator::accept public function
RecursiveExtensionFilterIterator::acceptTests public function Controls whether test directories will be scanned.
RecursiveExtensionFilterIterator::getChildren public function
RecursiveExtensionFilterIterator::__construct public function Construct a RecursiveExtensionFilterIterator.
doc_Drupal
2016-10-29 09:36:47
Comments
Leave a Comment

Please login to continue.