|
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; |
@@ -189,21 +188,15 @@ public function getRecipes(array $operations): array |
189 | 188 | $data['locks'][$package->getName()]['version'] = $version; |
190 | 189 | $data['locks'][$package->getName()]['recipe']['version'] = $v; |
191 | 190 |
|
192 | | - if (null !== $recipeRef) { |
193 | | - // TODO: add a new archived_recipe_template to _links |
194 | | - $endpointRoot = substr( |
195 | | - $this->endpoints[$endpoint]['_links']['recipe_template'], |
196 | | - 0, |
197 | | - strpos($this->endpoints[$endpoint]['_links']['recipe_template'], '{package_dotted}') |
198 | | - ); |
199 | | - // TODO: remove - just for testing |
200 | | - $endpointRoot = str_replace('symfony/recipes', 'weaverryan/recipes', $endpointRoot); |
201 | | - $urls[] = sprintf( |
202 | | - '%sarchived/%s/%s.json', |
203 | | - $endpointRoot, |
204 | | - str_replace('/', '.', $package->getName()), |
205 | | - $recipeRef |
206 | | - ); |
| 191 | + if (null !== $recipeRef && isset($this->endpoints[$endpoint]['_links']['archived_recipes_template'])) { |
| 192 | + $url = strtr($this->endpoints[$endpoint]['_links']['archived_recipes_template'], [ |
| 193 | + '{package_dotted}' => str_replace('/', '.', $package->getName()), |
| 194 | + '{ref}' => $recipeRef, |
| 195 | + ]); |
| 196 | + |
| 197 | + // TODO: remove once symfony/recipes has full history |
| 198 | + $url = str_replace('symfony/recipes', 'weaverryan/recipes', $url); |
| 199 | + $urls[] = $url; |
207 | 200 |
|
208 | 201 | break; |
209 | 202 | } |
|
0 commit comments