8000 minor #40557 [travis] use packagist API v2 (nicolas-grekas) · symfony/symfony@3d1c59a · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d1c59a

Browse files
minor #40557 [travis] use packagist API v2 (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [travis] use packagist API v2 | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- af43ca0 [travis] use packagist API v2
2 parents 1665555 + af43ca0 commit 3d1c59a

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

.github/rm-invalid-lowest-lock-files.php

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function getContentHash(array $composerJson)
6767

6868
$referencedCommits = [];
6969

70-
foreach ($composerJsons as list($dir, $lockedPackages)) {
70+
foreach ($composerJsons as [$dir, $lockedPackages]) {
7171
foreach ($lockedPackages as $lockedJson) {
7272
if (0 !== strpos($version = $lockedJson['version'], 'dev-') && '-dev' !== substr($version, -4)) {
7373
continue;
@@ -119,30 +119,36 @@ function getContentHash(array $composerJson)
119119
$chs = [];
120120

121121
foreach ($referencedCommits as $name => $dirsByCommit) {
122-
$chs[] = $ch = [curl_init(), fopen($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '$').'.json', 'wb')];
123-
curl_setopt($ch[0], CURLOPT_URL, 'https://repo.packagist.org/p/'.$name.'.json');
124-
curl_setopt($ch[0], CURLOPT_FILE, $ch[1]);
125-
curl_setopt($ch[0], CURLOPT_SHARE, $sh);
126-
curl_multi_add_handle($mh, $ch[0]);
122+
foreach (['', '~dev'] as $suffix) {
123+
$chs[] = $ch = [curl_init(), fopen($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '~').$suffix.'.json', 'w')];
124+
curl_setopt($ch[0], CURLOPT_URL, 'https://repo.packagist.org/p2/'.$name.$suffix.'.json');
125+
curl_setopt($ch[0], CURLOPT_FILE, $ch[1]);
126+
curl_setopt($ch[0], CURLOPT_SHARE, $sh);
127+
curl_multi_add_handle($mh, $ch[0]);
128+
}
127129
}
128130

129131
do {
130132
curl_multi_exec($mh, $active);
131133
curl_multi_select($mh);
132134
} while ($active);
133135

134-
foreach ($chs as list($ch, $fd)) {
136+
foreach ($chs as [$ch, $fd]) {
135137
curl_multi_remove_handle($mh, $ch);
136138
curl_close($ch);
137139
fclose($fd);
138140
}
139141

140142
foreach ($referencedCommits as $name => $dirsByCommit) {
141-
$repo = file_get_contents($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '$').'.json');
142-
$repo = json_decode($repo, true);
143+
foreach (['', '~dev'] as $suffix) {
144+
$repo = file_get_contents($_SERVER['HOME'].'/.cache/composer/repo/https---repo.packagist.org/provider-'.strtr($name, '/', '~').$suffix.'.json');
145+
$repo = json_decode($repo, true);
143146

144-
foreach ($repo['packages'][$name] as $version) {
145-
unset($referencedCommits[$name][$version['source']['reference']]);
147+
foreach ($repo['packages'][$name] as $version) {
148+
if (isset($version['source']['reference'])) {
149+
unset($referencedCommits[$name][$version['source']['reference']]);
150+
}
151+
}
146152
}
147153
}
148154

0 commit comments

Comments
 (0)
0