T357: Gracefully handle obviously invalid year tags.

This commit is contained in:
Peter Deltchev 2015-09-10 23:01:48 -07:00
parent 8a4b08738d
commit d78c240a42

View file

@ -173,6 +173,10 @@ class ImportMLPMA extends Command {
if ($taggedYear !== null && $modifiedDate->year === $taggedYear) {
$releasedAt = $modifiedDate;
} else if ($taggedYear !== null && (string) $taggedYear !== 4) {
$this->error('This track\'s tagged year makes no sense! Using the track\'s last modified date...');
$releasedAt = $modifiedDate;
} else if ($taggedYear !== null && $modifiedDate->year !== $taggedYear) {
$this->error('Release years don\'t match! Using the tagged year...');
$releasedAt = Carbon::create($taggedYear);