-
-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add detection for repo id changes on github/gitlab, preventing repoja…
…cked repos from updating further
- Loading branch information
Showing
6 changed files
with
147 additions
and
25 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,12 @@ | |
use Composer\Util\HttpDownloader; | ||
use DateTimeInterface; | ||
|
||
enum PackageFreezeReason: string | ||
{ | ||
case Spam = 'spam'; | ||
case RemoteIdMismatch = 'remote_id'; | ||
} | ||
|
||
/** | ||
* @author Jordi Boggiano <[email protected]> | ||
* @phpstan-import-type VersionArray from Version | ||
|
@@ -163,6 +169,12 @@ class Package | |
#[ORM\Column(type: 'string', length: 255, nullable: true)] | ||
private string|null $suspect = null; | ||
|
||
/** | ||
* If set, the content is the reason for being frozen | ||
*/ | ||
#[ORM\Column(nullable: true)] | ||
private PackageFreezeReason|null $frozen = null; | ||
|
||
/** | ||
* @internal | ||
* @var true|null|\Composer\Repository\Vcs\VcsDriverInterface | ||
|
@@ -720,6 +732,35 @@ public function getSuspect(): ?string | |
return $this->suspect; | ||
} | ||
|
||
public function freeze(PackageFreezeReason $reason): void | ||
{ | ||
$this->frozen = $reason; | ||
$this->setCrawledAt($dt = new \DateTimeImmutable('2100-01-01 00:00:00')); | ||
$this->setDumpedAt($dt); | ||
$this->setDumpedAtV2($dt); | ||
} | ||
|
||
public function unfreeze(): void | ||
{ | ||
if ($this->frozen === PackageFreezeReason::RemoteIdMismatch) { | ||
$this->setRemoteId(null); | ||
} | ||
$this->frozen = null; | ||
$this->setCrawledAt(null); | ||
$this->setDumpedAt(null); | ||
$this->setDumpedAtV2(null); | ||
} | ||
|
||
public function isFrozen(): bool | ||
{ | ||
return !is_null($this->frozen); | ||
} | ||
|
||
public function getFreezeReason(): ?PackageFreezeReason | ||
{ | ||
return $this->frozen; | ||
} | ||
|
||
public function isAbandoned(): bool | ||
{ | ||
return $this->abandoned; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters