|
|
@ -285,24 +285,24 @@ EOF;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
|
|
|
|
$this->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
|
|
|
|
file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
|
|
|
|
$this->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
|
|
|
|
file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
|
|
|
|
$this->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
|
|
|
|
$includePathFilePath = $targetDir.'/include_paths.php';
|
|
|
|
$includePathFilePath = $targetDir.'/include_paths.php';
|
|
|
|
if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
|
|
|
|
if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
|
|
|
|
file_put_contents($includePathFilePath, $includePathFileContents);
|
|
|
|
$this->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
|
|
|
|
} elseif (file_exists($includePathFilePath)) {
|
|
|
|
} elseif (file_exists($includePathFilePath)) {
|
|
|
|
unlink($includePathFilePath);
|
|
|
|
unlink($includePathFilePath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$includeFilesFilePath = $targetDir.'/autoload_files.php';
|
|
|
|
$includeFilesFilePath = $targetDir.'/autoload_files.php';
|
|
|
|
if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
|
|
|
|
if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
|
|
|
|
file_put_contents($includeFilesFilePath, $includeFilesFileContents);
|
|
|
|
$this->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
|
|
|
|
} elseif (file_exists($includeFilesFilePath)) {
|
|
|
|
} elseif (file_exists($includeFilesFilePath)) {
|
|
|
|
unlink($includeFilesFilePath);
|
|
|
|
unlink($includeFilesFilePath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
|
|
|
|
$this->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
|
|
|
|
file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
|
|
|
$this->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
|
|
|
file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
|
|
|
|
$this->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
|
|
|
|
|
|
|
|
|
|
|
|
$this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
|
|
|
$this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
|
|
|
|
$this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
|
|
|
|
$this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
|
|
|
@ -316,6 +316,16 @@ EOF;
|
|
|
|
return count($classMap);
|
|
|
|
return count($classMap);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private function filePutContentsIfModified($path, $content)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$currentContent = @file_get_contents($path);
|
|
|
|
|
|
|
|
if (!$currentContent || ($currentContent != $content)) {
|
|
|
|
|
|
|
|
return file_put_contents($path, $content);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, $autoloadType = null, array $classMap = array())
|
|
|
|
private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, $autoloadType = null, array $classMap = array())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter, $autoloadType) as $class => $path) {
|
|
|
|
foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter, $autoloadType) as $class => $path) {
|
|
|
@ -986,7 +996,6 @@ INITIALIZER;
|
|
|
|
|
|
|
|
|
|
|
|
$sortedPackages = PackageSorter::sortPackages($packages);
|
|
|
|
$sortedPackages = PackageSorter::sortPackages($packages);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sortedPackageMap = array();
|
|
|
|
$sortedPackageMap = array();
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($sortedPackages as $package) {
|
|
|
|
foreach ($sortedPackages as $package) {
|
|
|
@ -1005,6 +1014,7 @@ INITIALIZER;
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
protected function safeCopy($source, $target)
|
|
|
|
protected function safeCopy($source, $target)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
|
|
|
|
$source = fopen($source, 'r');
|
|
|
|
$source = fopen($source, 'r');
|
|
|
|
$target = fopen($target, 'w+');
|
|
|
|
$target = fopen($target, 'w+');
|
|
|
|
|
|
|
|
|
|
|
@ -1013,3 +1023,33 @@ INITIALIZER;
|
|
|
|
fclose($target);
|
|
|
|
fclose($target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* compare 2 files
|
|
|
|
|
|
|
|
* https://stackoverflow.com/questions/3060125/can-i-use-file-get-contents-to-compare-two-files
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private function filesAreEqual($a, $b)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Check if filesize is different
|
|
|
|
|
|
|
|
if (filesize($a) !== filesize($b)) {
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Check if content is different
|
|
|
|
|
|
|
|
$ah = fopen($a, 'rb');
|
|
|
|
|
|
|
|
$bh = fopen($b, 'rb');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$result = true;
|
|
|
|
|
|
|
|
while (!feof($ah)) {
|
|
|
|
|
|
|
|
if (fread($ah, 8192) != fread($bh, 8192)) {
|
|
|
|
|
|
|
|
$result = false;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fclose($ah);
|
|
|
|
|
|
|
|
fclose($bh);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|