1
0
Fork 0

Re-use existing autoloader suffix if available, fixes #3701

pull/3840/head
Jordi Boggiano 2015-03-09 11:12:32 +00:00
parent fed81ee47c
commit b296e654eb
1 changed files with 10 additions and 1 deletions

View File

@ -214,7 +214,16 @@ EOF;
$classmapFile .= ");\n";
if (!$suffix) {
$suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
if (is_readable($vendorPath.'/autoload.php')) {
$content = file_get_contents($vendorPath.'/autoload.php');
if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
$suffix = $match[1];
}
}
if (!$suffix) {
$suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
}
}
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);