Add support for gitlab.com URL replacement, fixes #7160
parent
066351c5b9
commit
4bddcd7124
|
@ -1184,9 +1184,9 @@ class Installer
|
||||||
$package->setSourceReference($sourceReference);
|
$package->setSourceReference($sourceReference);
|
||||||
}
|
}
|
||||||
|
|
||||||
// only update dist url for github/bitbucket dists as they use a combination of dist url + dist reference to install
|
// only update dist url for github/bitbucket/gitlab dists as they use a combination of dist url + dist reference to install
|
||||||
// but for other urls this is ambiguous and could result in bad outcomes
|
// but for other urls this is ambiguous and could result in bad outcomes
|
||||||
if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $distUrl)) {
|
if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
|
||||||
$package->setDistUrl($distUrl);
|
$package->setDistUrl($distUrl);
|
||||||
$this->updateInstallReferences($package, $sourceReference);
|
$this->updateInstallReferences($package, $sourceReference);
|
||||||
}
|
}
|
||||||
|
@ -1204,9 +1204,9 @@ class Installer
|
||||||
|
|
||||||
$package->setSourceReference($reference);
|
$package->setSourceReference($reference);
|
||||||
|
|
||||||
if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com)/}i', $package->getDistUrl())) {
|
if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
|
||||||
$package->setDistReference($reference);
|
$package->setDistReference($reference);
|
||||||
$package->setDistUrl(preg_replace('{(?<=/)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
|
$package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
|
||||||
} elseif ($package->getDistReference()) { // update the dist reference if there was one, but if none was provided ignore it
|
} elseif ($package->getDistReference()) { // update the dist reference if there was one, but if none was provided ignore it
|
||||||
$package->setDistReference($reference);
|
$package->setDistReference($reference);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue