Skip to content

Commit 5f409c7

Browse files
author
sayan goswami
committed
Merge branch 'hotfix/3.27.1'
2 parents 7e8330b + c286038 commit 5f409c7

File tree

3 files changed

+440
-139
lines changed

3 files changed

+440
-139
lines changed

config/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v3.27.0
1+
v3.27.1

src/Domain/Composer/Version/DrupalCoreVersionResolver.php

Lines changed: 90 additions & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22

3-
// phpcs:ignoreFile
4-
53
namespace Acquia\Orca\Domain\Composer\Version;
64

75
use Acquia\Orca\Enum\DrupalCoreVersionEnum;
@@ -198,19 +196,14 @@ public function resolveArbitrary(string $version, string $preferred_stability =
198196
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
199197
*/
200198
private function findOldestSupported(): string {
201-
// @todo The dynamic functionality here has been temporarily replaced with
202-
// a hardcoded value to give us time before the Drupal 10 release takes
203-
// effect in our core version spread.
204-
// if ($this->oldestSupported) {
205-
// return $this->oldestSupported;
206-
// }
207-
//
208-
// $branch = $this->drupalDotOrgApiClient->getOldestSupportedDrupalCoreBranch();
209-
// $this->oldestSupported = $this->resolveArbitrary($branch, 'stable');
210-
//
211-
// return $this->oldestSupported;
212-
213-
return '9.3.22';
199+
if ($this->oldestSupported) {
200+
return $this->oldestSupported;
201+
}
202+
203+
$branch = $this->drupalDotOrgApiClient->getOldestSupportedDrupalCoreBranch();
204+
$this->oldestSupported = $this->resolveArbitrary($branch, 'stable');
205+
206+
return $this->oldestSupported;
214207
}
215208

216209
/**
@@ -222,28 +215,22 @@ private function findOldestSupported(): string {
222215
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
223216
*/
224217
private function findLatestLts(): string {
225-
// @todo The dynamic functionality here has been temporarily replaced with
226-
// a hardcoded value to give us time before the Drupal 10 release takes
227-
// effect in our core version spread.
228-
// if ($this->latestLts) {
229-
// return $this->latestLts;
230-
// }
231-
//
232-
// $parts = explode('.', $this->findCurrent());
233-
// $current_major = array_shift($parts);
234-
//
235-
// // Gets the oldest supported version of Drupal Core.
236-
// $oldestSupported = $this->findOldestSupported();
237-
// // If oldest supported Drupal Core version is less than current major.
238-
// if ((int) $oldestSupported < (int) $current_major) {
239-
// $this->latestLts = $oldestSupported;
240-
// return $this->latestLts;
241-
// }
242-
//
243-
// $message = "No Drupal core version satisfies the given constraints: oldest supported ($oldestSupported) less than current major ($current_major)";
244-
// throw new OrcaVersionNotFoundException($message);
245-
246-
$message = 'No Drupal core version satisfies the given constraints: oldest supported (9.3.22) less than current major (9)';
218+
if ($this->latestLts) {
219+
return $this->latestLts;
220+
}
221+
222+
$parts = explode('.', $this->findCurrent());
223+
$current_major = array_shift($parts);
224+
225+
// Gets the oldest supported version of Drupal Core.
226+
$oldestSupported = $this->findOldestSupported();
227+
// If oldest supported Drupal Core version is less than current major.
228+
if ((int) $oldestSupported < (int) $current_major) {
229+
$this->latestLts = $oldestSupported;
230+
return $this->latestLts;
231+
}
232+
233+
$message = "No Drupal core version satisfies the given constraints: oldest supported ($oldestSupported) less than current major ($current_major)";
247234
throw new OrcaVersionNotFoundException($message);
248235
}
249236

@@ -256,21 +243,16 @@ private function findLatestLts(): string {
256243
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
257244
*/
258245
private function findPreviousMinor(): string {
259-
// @todo The dynamic functionality here has been temporarily replaced with
260-
// a hardcoded value to give us time before the Drupal 10 release takes
261-
// effect in our core version spread.
262-
// if ($this->previousMinor) {
263-
// return $this->previousMinor;
264-
// }
265-
//
266-
// $parts = explode('.', $this->findCurrent());
267-
// array_pop($parts);
268-
// $current_minor = implode('.', $parts);
269-
// $this->previousMinor = $this
270-
// ->resolveArbitrary("<{$current_minor}", 'stable');
271-
// return $this->previousMinor;
272-
273-
return '9.3.22';
246+
if ($this->previousMinor) {
247+
return $this->previousMinor;
248+
}
249+
250+
$parts = explode('.', $this->findCurrent());
251+
array_pop($parts);
252+
$current_minor = implode('.', $parts);
253+
$this->previousMinor = $this
254+
->resolveArbitrary("<{$current_minor}", 'stable');
255+
return $this->previousMinor;
274256
}
275257

276258
/**
@@ -280,24 +262,19 @@ private function findPreviousMinor(): string {
280262
* The semver version string, e.g., 9.1.0.
281263
*/
282264
private function findCurrent(): string {
283-
// @todo The dynamic functionality here has been temporarily replaced with
284-
// a hardcoded value to give us time before the Drupal 10 release takes
285-
// effect in our core version spread.
286-
// if ($this->current) {
287-
// return $this->current;
288-
// }
289-
//
290-
// try {
291-
// $candidate = $this->resolveArbitrary('*', 'stable');
292-
// }
293-
// catch (OrcaVersionNotFoundException $e) {
294-
// throw new \LogicException('Could not find current version of Drupal core.');
295-
// }
296-
// $this->current = $candidate;
297-
//
298-
// return $this->current;
299-
300-
return '9.4.9';
265+
if ($this->current) {
266+
return $this->current;
267+
}
268+
269+
try {
270+
$candidate = $this->resolveArbitrary('*', 'stable');
271+
}
272+
catch (OrcaVersionNotFoundException $e) {
273+
throw new \LogicException('Could not find current version of Drupal core.');
274+
}
275+
$this->current = $candidate;
276+
277+
return $this->current;
301278
}
302279

303280
/**
@@ -307,12 +284,7 @@ private function findCurrent(): string {
307284
* The semver version string, e.g., 9.1.x-dev.
308285
*/
309286
private function findCurrentDev(): string {
310-
// @todo The dynamic functionality here has been temporarily replaced with
311-
// a hardcoded value to give us time before the Drupal 10 release takes
312-
// effect in our core version spread.
313-
// return $this->convertToDev($this->findCurrent());
314-
315-
return '9.4.x-dev';
287+
return $this->convertToDev($this->findCurrent());
316288
}
317289

318290
/**
@@ -324,19 +296,14 @@ private function findCurrentDev(): string {
324296
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
325297
*/
326298
private function findNextMinor(): string {
327-
// @todo The dynamic functionality here has been temporarily replaced with
328-
// a hardcoded value to give us time before the Drupal 10 release takes
329-
// effect in our core version spread.
330-
// if ($this->nextMinor) {
331-
// return $this->nextMinor;
332-
// }
333-
//
334-
// $this->nextMinor = $this
335-
// ->resolveArbitrary("~{$this->findNextMinorUnresolved()}", 'alpha', FALSE);
336-
//
337-
// return $this->nextMinor;
338-
339-
return '9.5.0-rc2';
299+
if ($this->nextMinor) {
300+
return $this->nextMinor;
301+
}
302+
303+
$this->nextMinor = $this
304+
->resolveArbitrary("~{$this->findNextMinorUnresolved()}", 'alpha', FALSE);
305+
306+
return $this->nextMinor;
340307
}
341308

342309
/**
@@ -360,19 +327,14 @@ private function findNextMinorUnresolved(): string {
360327
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
361328
*/
362329
private function findNextMinorDev(): string {
363-
// @todo The dynamic functionality here has been temporarily replaced with
364-
// a hardcoded value to give us time before the Drupal 10 release takes
365-
// effect in our core version spread.
366-
// if ($this->nextMinorDev) {
367-
// return $this->nextMinorDev;
368-
// }
369-
//
370-
// $next_minor = $this->findNextMinorUnresolved();
371-
// $this->nextMinorDev = $this->convertToDev($next_minor);
372-
//
373-
// return $this->nextMinorDev;
374-
375-
return '9.5.x-dev';
330+
if ($this->nextMinorDev) {
331+
return $this->nextMinorDev;
332+
}
333+
334+
$next_minor = $this->findNextMinorUnresolved();
335+
$this->nextMinorDev = $this->convertToDev($next_minor);
336+
337+
return $this->nextMinorDev;
376338
}
377339

378340
/**
@@ -384,25 +346,20 @@ private function findNextMinorDev(): string {
384346
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
385347
*/
386348
private function findNextMajorLatestMinorBetaOrLater(): string {
387-
// @todo The dynamic functionality here has been temporarily replaced with
388-
// a hardcoded value to give us time before the Drupal 10 release takes
389-
// effect in our core version spread.
390-
// if ($this->nextMajorLatestMinorBetaOrLater) {
391-
// return $this->nextMajorLatestMinorBetaOrLater;
392-
// }
393-
//
394-
// $parts = explode('.', $this->findCurrent());
395-
// $major = $parts[0];
396-
// $major++;
397-
//
398-
// $this->nextMajorLatestMinorBetaOrLater = $this
399-
// ->resolveArbitrary("^{$major}", 'beta');
400-
//
401-
// $this->assertNextMajorLatestMinorBetaOrLaterExists();
402-
//
403-
// return $this->nextMajorLatestMinorBetaOrLater;
404-
405-
return '10.0.0-rc3';
349+
if ($this->nextMajorLatestMinorBetaOrLater) {
350+
return $this->nextMajorLatestMinorBetaOrLater;
351+
}
352+
353+
$parts = explode('.', $this->findCurrent());
354+
$major = $parts[0];
355+
$major++;
356+
357+
$this->nextMajorLatestMinorBetaOrLater = $this
358+
->resolveArbitrary("^{$major}", 'beta');
359+
360+
$this->assertNextMajorLatestMinorBetaOrLaterExists();
361+
362+
return $this->nextMajorLatestMinorBetaOrLater;
406363
}
407364

408365
/**
@@ -414,23 +371,18 @@ private function findNextMajorLatestMinorBetaOrLater(): string {
414371
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
415372
*/
416373
private function findNextMajorLatestMinorDev(): string {
417-
// @todo The dynamic functionality here has been temporarily replaced with
418-
// a hardcoded value to give us time before the Drupal 10 release takes
419-
// effect in our core version spread.
420-
// if ($this->nextMajorLatestMinorDev) {
421-
// return $this->nextMajorLatestMinorDev;
422-
// }
423-
//
424-
// $parts = explode('.', $this->findCurrent());
425-
// $major = $parts[0];
426-
// $major++;
427-
//
428-
// $this->nextMajorLatestMinorDev = $this
429-
// ->resolveArbitrary("^{$major}", 'dev');
430-
//
431-
// return $this->nextMajorLatestMinorDev;
432-
433-
return '10.1.x-dev';
374+
if ($this->nextMajorLatestMinorDev) {
375+
return $this->nextMajorLatestMinorDev;
376+
}
377+
378+
$parts = explode('.', $this->findCurrent());
379+
$major = $parts[0];
380+
$major++;
381+
382+
$this->nextMajorLatestMinorDev = $this
383+
->resolveArbitrary("^{$major}", 'dev');
384+
385+
return $this->nextMajorLatestMinorDev;
434386
}
435387

436388
/**

0 commit comments

Comments
 (0)