Skip to content

Commit

Permalink
Merge branch 'hotfix/3.27.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan goswami committed Jan 17, 2023
2 parents 7e8330b + c286038 commit 5f409c7
Show file tree
Hide file tree
Showing 3 changed files with 440 additions and 139 deletions.
2 changes: 1 addition & 1 deletion config/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v3.27.0
v3.27.1
228 changes: 90 additions & 138 deletions src/Domain/Composer/Version/DrupalCoreVersionResolver.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

// phpcs:ignoreFile

namespace Acquia\Orca\Domain\Composer\Version;

use Acquia\Orca\Enum\DrupalCoreVersionEnum;
Expand Down Expand Up @@ -198,19 +196,14 @@ public function resolveArbitrary(string $version, string $preferred_stability =
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
*/
private function findOldestSupported(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// if ($this->oldestSupported) {
// return $this->oldestSupported;
// }
//
// $branch = $this->drupalDotOrgApiClient->getOldestSupportedDrupalCoreBranch();
// $this->oldestSupported = $this->resolveArbitrary($branch, 'stable');
//
// return $this->oldestSupported;

return '9.3.22';
if ($this->oldestSupported) {
return $this->oldestSupported;
}

$branch = $this->drupalDotOrgApiClient->getOldestSupportedDrupalCoreBranch();
$this->oldestSupported = $this->resolveArbitrary($branch, 'stable');

return $this->oldestSupported;
}

/**
Expand All @@ -222,28 +215,22 @@ private function findOldestSupported(): string {
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
*/
private function findLatestLts(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// if ($this->latestLts) {
// return $this->latestLts;
// }
//
// $parts = explode('.', $this->findCurrent());
// $current_major = array_shift($parts);
//
// // Gets the oldest supported version of Drupal Core.
// $oldestSupported = $this->findOldestSupported();
// // If oldest supported Drupal Core version is less than current major.
// if ((int) $oldestSupported < (int) $current_major) {
// $this->latestLts = $oldestSupported;
// return $this->latestLts;
// }
//
// $message = "No Drupal core version satisfies the given constraints: oldest supported ($oldestSupported) less than current major ($current_major)";
// throw new OrcaVersionNotFoundException($message);

$message = 'No Drupal core version satisfies the given constraints: oldest supported (9.3.22) less than current major (9)';
if ($this->latestLts) {
return $this->latestLts;
}

$parts = explode('.', $this->findCurrent());
$current_major = array_shift($parts);

// Gets the oldest supported version of Drupal Core.
$oldestSupported = $this->findOldestSupported();
// If oldest supported Drupal Core version is less than current major.
if ((int) $oldestSupported < (int) $current_major) {
$this->latestLts = $oldestSupported;
return $this->latestLts;
}

$message = "No Drupal core version satisfies the given constraints: oldest supported ($oldestSupported) less than current major ($current_major)";
throw new OrcaVersionNotFoundException($message);
}

Expand All @@ -256,21 +243,16 @@ private function findLatestLts(): string {
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
*/
private function findPreviousMinor(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// if ($this->previousMinor) {
// return $this->previousMinor;
// }
//
// $parts = explode('.', $this->findCurrent());
// array_pop($parts);
// $current_minor = implode('.', $parts);
// $this->previousMinor = $this
// ->resolveArbitrary("<{$current_minor}", 'stable');
// return $this->previousMinor;

return '9.3.22';
if ($this->previousMinor) {
return $this->previousMinor;
}

$parts = explode('.', $this->findCurrent());
array_pop($parts);
$current_minor = implode('.', $parts);
$this->previousMinor = $this
->resolveArbitrary("<{$current_minor}", 'stable');
return $this->previousMinor;
}

/**
Expand All @@ -280,24 +262,19 @@ private function findPreviousMinor(): string {
* The semver version string, e.g., 9.1.0.
*/
private function findCurrent(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// if ($this->current) {
// return $this->current;
// }
//
// try {
// $candidate = $this->resolveArbitrary('*', 'stable');
// }
// catch (OrcaVersionNotFoundException $e) {
// throw new \LogicException('Could not find current version of Drupal core.');
// }
// $this->current = $candidate;
//
// return $this->current;

return '9.4.9';
if ($this->current) {
return $this->current;
}

try {
$candidate = $this->resolveArbitrary('*', 'stable');
}
catch (OrcaVersionNotFoundException $e) {
throw new \LogicException('Could not find current version of Drupal core.');
}
$this->current = $candidate;

return $this->current;
}

/**
Expand All @@ -307,12 +284,7 @@ private function findCurrent(): string {
* The semver version string, e.g., 9.1.x-dev.
*/
private function findCurrentDev(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// return $this->convertToDev($this->findCurrent());

return '9.4.x-dev';
return $this->convertToDev($this->findCurrent());
}

/**
Expand All @@ -324,19 +296,14 @@ private function findCurrentDev(): string {
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
*/
private function findNextMinor(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// if ($this->nextMinor) {
// return $this->nextMinor;
// }
//
// $this->nextMinor = $this
// ->resolveArbitrary("~{$this->findNextMinorUnresolved()}", 'alpha', FALSE);
//
// return $this->nextMinor;

return '9.5.0-rc2';
if ($this->nextMinor) {
return $this->nextMinor;
}

$this->nextMinor = $this
->resolveArbitrary("~{$this->findNextMinorUnresolved()}", 'alpha', FALSE);

return $this->nextMinor;
}

/**
Expand All @@ -360,19 +327,14 @@ private function findNextMinorUnresolved(): string {
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
*/
private function findNextMinorDev(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// if ($this->nextMinorDev) {
// return $this->nextMinorDev;
// }
//
// $next_minor = $this->findNextMinorUnresolved();
// $this->nextMinorDev = $this->convertToDev($next_minor);
//
// return $this->nextMinorDev;

return '9.5.x-dev';
if ($this->nextMinorDev) {
return $this->nextMinorDev;
}

$next_minor = $this->findNextMinorUnresolved();
$this->nextMinorDev = $this->convertToDev($next_minor);

return $this->nextMinorDev;
}

/**
Expand All @@ -384,25 +346,20 @@ private function findNextMinorDev(): string {
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
*/
private function findNextMajorLatestMinorBetaOrLater(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// if ($this->nextMajorLatestMinorBetaOrLater) {
// return $this->nextMajorLatestMinorBetaOrLater;
// }
//
// $parts = explode('.', $this->findCurrent());
// $major = $parts[0];
// $major++;
//
// $this->nextMajorLatestMinorBetaOrLater = $this
// ->resolveArbitrary("^{$major}", 'beta');
//
// $this->assertNextMajorLatestMinorBetaOrLaterExists();
//
// return $this->nextMajorLatestMinorBetaOrLater;

return '10.0.0-rc3';
if ($this->nextMajorLatestMinorBetaOrLater) {
return $this->nextMajorLatestMinorBetaOrLater;
}

$parts = explode('.', $this->findCurrent());
$major = $parts[0];
$major++;

$this->nextMajorLatestMinorBetaOrLater = $this
->resolveArbitrary("^{$major}", 'beta');

$this->assertNextMajorLatestMinorBetaOrLaterExists();

return $this->nextMajorLatestMinorBetaOrLater;
}

/**
Expand All @@ -414,23 +371,18 @@ private function findNextMajorLatestMinorBetaOrLater(): string {
* @throws \Acquia\Orca\Exception\OrcaVersionNotFoundException
*/
private function findNextMajorLatestMinorDev(): string {
// @todo The dynamic functionality here has been temporarily replaced with
// a hardcoded value to give us time before the Drupal 10 release takes
// effect in our core version spread.
// if ($this->nextMajorLatestMinorDev) {
// return $this->nextMajorLatestMinorDev;
// }
//
// $parts = explode('.', $this->findCurrent());
// $major = $parts[0];
// $major++;
//
// $this->nextMajorLatestMinorDev = $this
// ->resolveArbitrary("^{$major}", 'dev');
//
// return $this->nextMajorLatestMinorDev;

return '10.1.x-dev';
if ($this->nextMajorLatestMinorDev) {
return $this->nextMajorLatestMinorDev;
}

$parts = explode('.', $this->findCurrent());
$major = $parts[0];
$major++;

$this->nextMajorLatestMinorDev = $this
->resolveArbitrary("^{$major}", 'dev');

return $this->nextMajorLatestMinorDev;
}

/**
Expand Down
Loading

0 comments on commit 5f409c7

Please sign in to comment.