Merge pull request #4356 from alcohol/add-license-file-to-composer-vendor-dir
copy LICENSE file during autoload dumping ( refs #4288 )pull/4357/head
commit
6c7e4a671b
|
@ -261,14 +261,8 @@ EOF;
|
||||||
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
||||||
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFile, $targetDirLoader, (bool) $includeFilesFile, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $classMapAuthoritative));
|
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFile, $targetDirLoader, (bool) $includeFilesFile, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $classMapAuthoritative));
|
||||||
|
|
||||||
// use stream_copy_to_stream instead of copy
|
$this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
||||||
// to work around https://bugs.php.net/bug.php?id=64634
|
$this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
|
||||||
$sourceLoader = fopen(__DIR__.'/ClassLoader.php', 'r');
|
|
||||||
$targetLoader = fopen($targetDir.'/ClassLoader.php', 'w+');
|
|
||||||
stream_copy_to_stream($sourceLoader, $targetLoader);
|
|
||||||
fclose($sourceLoader);
|
|
||||||
fclose($targetLoader);
|
|
||||||
unset($sourceLoader, $targetLoader);
|
|
||||||
|
|
||||||
$this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
|
$this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
|
||||||
'optimize' => (bool) $scanPsr0Packages,
|
'optimize' => (bool) $scanPsr0Packages,
|
||||||
|
@ -750,4 +744,20 @@ FOOTER;
|
||||||
|
|
||||||
return $sortedPackageMap;
|
return $sortedPackageMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy file using stream_copy_to_stream to work around https://bugs.php.net/bug.php?id=6463
|
||||||
|
*
|
||||||
|
* @param string $source
|
||||||
|
* @param string $target
|
||||||
|
*/
|
||||||
|
protected function safeCopy($source, $target)
|
||||||
|
{
|
||||||
|
$source = fopen($source, 'r');
|
||||||
|
$target = fopen($target, 'w+');
|
||||||
|
|
||||||
|
stream_copy_to_stream($source, $target);
|
||||||
|
fclose($source);
|
||||||
|
fclose($target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue