Problem/Motivation
To avoid performance deficit when multiple modules are missing. The deficit occurs because the "modules" directory is rescanned perpetually to look for missing modules on certain pages, such as admin/config.
Proposed resolution
The solutions is to cache the result of the scanning of the "modules" directory in a static variable.
Remaining tasks
None.
User interface changes
None.
API changes
None.
Original report by mfb
This patch provides a performance boost for sites that are missing modules (common on old sites which have been maintained for many years). In this case, drupal_system_listing() and file_scan_directory() will be called over and over looking for missing modules on certain pages, such as admin/config.
This patch adds an additional static variable to drupal_get_filename() to store an array of mask-directory combinations that have been scanned. Once one scan has been performed for a particular extension in a particular directory, there is no need to run the same scan later in the same request.