function composer_autoload_cache_rebuild in Composer Autoload 6
Same name and namespace in other branches
- 7 composer_autoload.module \composer_autoload_cache_rebuild()
Rebuild composer autoload.php file list cache.
Return value
An array of autoload.php file paths relative to DRUPAL_ROOT.
1 call to composer_autoload_cache_rebuild()
- composer_autoload_init in ./
composer_autoload.module - Implements hook_init().
File
- ./
composer_autoload.module, line 34 - Provides primary Drupal hook implementations.
Code
function composer_autoload_cache_rebuild() {
$loaders = array();
// Cycle through each of the enabled modules and check for autoload.php.
$modules = module_list();
foreach ($modules as $module) {
$path = drupal_get_path('module', $module);
if ($files = file_scan_directory($path, 'autoload\\.php')) {
$loaders = array_merge($loaders, array_keys($files));
}
}
// Cache list of loaders and return for immediate use.
cache_set('composer_autoload', $loaders);
return $loaders;
}