|
29 | 29 | class Downloader
|
30 | 30 | {
|
31 | 31 | private const DEFAULT_ENDPOINTS = [
|
32 |
| - // TODO: REVERT THIS |
33 |
| - 'https://raw.githubusercontent.com/weaverryan/recipes/flex/main/index.json', |
| 32 | + 'https://raw.githubusercontent.com/symfony/recipes/flex/main/index.json', |
34 | 33 | 'https://raw.githubusercontent.com/symfony/recipes-contrib/flex/main/index.json',
|
35 | 34 | ];
|
36 | 35 | private const MAX_LENGTH = 1000;
|
@@ -183,21 +182,15 @@ public function getRecipes(array $operations): array
|
183 | 182 | $data['locks'][$package->getName()]['version'] = $version;
|
184 | 183 | $data['locks'][$package->getName()]['recipe']['version'] = $v;
|
185 | 184 |
|
186 |
| - if (null !== $recipeRef) { |
187 |
| - // TODO: add a new archived_recipe_template to _links |
188 |
| - $endpointRoot = substr( |
189 |
| - $this->endpoints[$endpoint]['_links']['recipe_template'], |
190 |
| - 0, |
191 |
| - strpos($this->endpoints[$endpoint]['_links']['recipe_template'], '{package_dotted}') |
192 |
| - ); |
193 |
| - // TODO: remove - just for testing |
194 |
| - $endpointRoot = str_replace('symfony/recipes', 'weaverryan/recipes', $endpointRoot); |
195 |
| - $urls[] = sprintf( |
196 |
| - '%sarchived/%s/%s.json', |
197 |
| - $endpointRoot, |
198 |
| - str_replace('/', '.', $package->getName()), |
199 |
| - $recipeRef |
200 |
| - ); |
| 185 | + if (null !== $recipeRef && isset($this->endpoints[$endpoint]['_links']['archived_recipes_template'])) { |
| 186 | + $url = strtr($this->endpoints[$endpoint]['_links']['archived_recipes_template'], [ |
| 187 | + '{package_dotted}' => str_replace('/', '.', $package->getName()), |
| 188 | + '{ref}' => $recipeRef, |
| 189 | + ]); |
| 190 | + |
| 191 | + // TODO: remove once symfony/recipes has full history |
| 192 | + $url = str_replace('symfony/recipes', 'weaverryan/recipes', $url); |
| 193 | + $urls[] = $url; |
201 | 194 |
|
202 | 195 | break;
|
203 | 196 | }
|
|
0 commit comments