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.
We cache any missing files in a static variable as well as in cache_bootstrap (for about 24 hours, or until we visit the themes/modules overview page). We also do a trigger_error() as soon as we find a missing module.
In a followup issue we can check for this in hook_requirements() as well.
User interface changes
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.
This information will be cached in 'drupal_get_filename:missing' in cache_bootstrap as well. Invalidation of this cache happens upon running cron, and upon visiting the themes/modules overview pages.
Beta phase evaluation
|Issue category||Bug because significant performance slowdown|
|Issue priority||Major because significant performance slowdown.|
|Prioritized changes||The main goal of this issue is performance|
|PASSED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,788 pass(es).|
|FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,759 pass(es), 0 fail(s), and 4 exception(s).|
|FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 91,767 pass(es), 0 fail(s), and 11 exception(s).|