Remove checks against EBOOK_EARLIEST_CREATION_DATE

This commit is contained in:
Mike Colagrosso 2024-10-22 17:16:28 -06:00 committed by Alex Cabal
parent 432723eafe
commit 6bec232d37
6 changed files with 6 additions and 7 deletions

View file

@ -36,7 +36,6 @@ const EBOOKS_PER_PAGE = 12;
const EBOOKS_MAX_STRING_LENGTH = 250;
const EBOOKS_MAX_LONG_STRING_LENGTH = 500;
const EBOOK_SINGLE_PAGE_SIZE_WARNING = 3 *1024 * 1024; // 3145728
const EBOOK_EARLIEST_CREATION_DATE = new DateTimeImmutable('2014-01-01');
const ARTWORK_THUMBNAIL_HEIGHT = 350;
const ARTWORK_THUMBNAIL_WIDTH = 350;

View file

@ -1207,7 +1207,7 @@ class Ebook{
}
if(isset($this->EbookCreated)){
if($this->EbookCreated > $now || $this->EbookCreated < EBOOK_EARLIEST_CREATION_DATE){
if($this->EbookCreated > $now){
$error->Add(new Exceptions\InvalidEbookCreatedDatetimeException($this->EbookCreated));
}
}
@ -1216,7 +1216,7 @@ class Ebook{
}
if(isset($this->EbookUpdated)){
if($this->EbookUpdated > $now || $this->EbookUpdated < EBOOK_EARLIEST_CREATION_DATE){
if($this->EbookUpdated > $now){
$error->Add(new Exceptions\InvalidEbookUpdatedDatetimeException($this->EbookUpdated));
}

View file

@ -10,6 +10,6 @@ class InvalidEbookCreatedDatetimeException extends AppException{
public function __construct(DateTimeImmutable $createdDatetime){
/** @throws void */
$now = new DateTimeImmutable();
$this->message = 'Invalid EbookCreated datetime. ' . $createdDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
$this->message = 'Invalid EbookCreated datetime. ' . $createdDatetime->format('Y-m-d') . ' is after ' . $now->format('Y-m-d') . '.';
}
}

View file

@ -10,6 +10,6 @@ class InvalidEbookUpdatedDatetimeException extends AppException{
public function __construct(DateTimeImmutable $updatedDatetime){
/** @throws void */
$now = new DateTimeImmutable();
$this->message = 'Invalid EbookUpdated datetime. ' . $updatedDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
$this->message = 'Invalid EbookUpdated datetime. ' . $updatedDatetime->format('Y-m-d') . ' is after ' . $now->format('Y-m-d') . '.';
}
}

View file

@ -10,6 +10,6 @@ class InvalidGitCommitCreatedDatetimeException extends AppException{
public function __construct(DateTimeImmutable $createdDatetime){
/** @throws void */
$now = new DateTimeImmutable();
$this->message = 'Invalid GitCommit Created datetime. ' . $createdDatetime->format('Y-m-d') . ' is not between ' . EBOOK_EARLIEST_CREATION_DATE->format('Y-m-d') . ' and ' . $now->format('Y-m-d') . '.';
$this->message = 'Invalid GitCommit Created datetime. ' . $createdDatetime->format('Y-m-d') . ' is after ' . $now->format('Y-m-d') . '.';
}
}

View file

@ -37,7 +37,7 @@ class GitCommit{
}
if(isset($this->Created)){
if($this->Created > $now || $this->Created < EBOOK_EARLIEST_CREATION_DATE){
if($this->Created > $now){
$error->Add(new Exceptions\InvalidGitCommitCreatedDatetimeException($this->Created));
}
}