function composer_autoload_cache_rebuild in Composer Autoload 7
Same name and namespace in other branches
- 6 composer_autoload.module \composer_autoload_cache_rebuild()
Rebuild composer autoload.php file list cache.
Return value
array An array of autoload.php file paths relative to DRUPAL_ROOT.
1 call to composer_autoload_cache_rebuild()
- composer_autoload_get_autoload_paths in ./
composer_autoload.module - Returns the cached list of autoload.php files.
File
- ./
composer_autoload.module, line 53 - 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));
}
}
// Add the custom Composer autoload.php path.
$custom = variable_get('composer_autoload_path', 'sites/all/vendor/autoload.php');
if (!empty($custom) && is_file($custom)) {
$loaders[] = $custom;
}
// Allow other modules to modify the autoload.php array.
drupal_alter('composer_autoload_loaders', $loaders);
return $loaders;
}