Re-use existing autoloader suffix if available, fixes #3701
parent
fed81ee47c
commit
b296e654eb
|
@ -213,9 +213,18 @@ EOF;
|
|||
}
|
||||
$classmapFile .= ");\n";
|
||||
|
||||
if (!$suffix) {
|
||||
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);
|
||||
file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
|
||||
|
|
Loading…
Reference in New Issue