mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
Make IndexableText optional
Placeholders do not have FullTitle, AlternateTitle, Tags, LocSubjects, or TocEntries.
This commit is contained in:
parent
1629d3a1a1
commit
a3ce3f1ec1
3 changed files with 7 additions and 20 deletions
|
@ -24,7 +24,7 @@ CREATE TABLE IF NOT EXISTS `Ebooks` (
|
|||
`EbookCreated` datetime NULL,
|
||||
`EbookUpdated` datetime NULL,
|
||||
`TextSinglePageByteCount` bigint unsigned NULL,
|
||||
`IndexableText` text NOT NULL,
|
||||
`IndexableText` text NULL,
|
||||
`IndexableAuthors` text NOT NULL,
|
||||
`IndexableCollections` text NULL,
|
||||
PRIMARY KEY (`EbookId`),
|
||||
|
|
|
@ -43,7 +43,7 @@ use function Safe\shell_exec;
|
|||
* @property string $TextUrl
|
||||
* @property string $TextSinglePageUrl
|
||||
* @property string $TextSinglePageSizeFormatted
|
||||
* @property string $IndexableText
|
||||
* @property ?string $IndexableText
|
||||
* @property string $IndexableAuthors
|
||||
* @property ?string $IndexableCollections
|
||||
* @property ?EbookPlaceholder $EbookPlaceholder
|
||||
|
@ -129,7 +129,7 @@ final class Ebook{
|
|||
protected string $_TextUrl;
|
||||
protected string $_TextSinglePageUrl;
|
||||
protected string $_TextSinglePageSizeFormatted;
|
||||
protected string $_IndexableText;
|
||||
protected ?string $_IndexableText = null;
|
||||
protected string $_IndexableAuthors;
|
||||
protected ?string $_IndexableCollections = null;
|
||||
protected ?EbookPlaceholder $_EbookPlaceholder = null;
|
||||
|
@ -708,7 +708,7 @@ final class Ebook{
|
|||
return $this->_TextSinglePageSizeFormatted;
|
||||
}
|
||||
|
||||
protected function GetIndexableText(): string{
|
||||
protected function GetIndexableText(): ?string{
|
||||
if(!isset($this->_IndexableText)){
|
||||
$this->_IndexableText = $this->FullTitle ?? '';
|
||||
|
||||
|
@ -1573,15 +1573,9 @@ final class Ebook{
|
|||
}
|
||||
}
|
||||
|
||||
if(isset($this->IndexableText)){
|
||||
$this->IndexableText = trim($this->IndexableText);
|
||||
|
||||
$this->IndexableText = trim($this->IndexableText ?? '');
|
||||
if($this->IndexableText == ''){
|
||||
$error->Add(new Exceptions\EbookIndexableTextRequiredException());
|
||||
}
|
||||
}
|
||||
else{
|
||||
$error->Add(new Exceptions\EbookIndexableTextRequiredException());
|
||||
$this->IndexableText = null;
|
||||
}
|
||||
|
||||
if(isset($this->IndexableAuthors)){
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
<?
|
||||
namespace Exceptions;
|
||||
|
||||
class EbookIndexableTextRequiredException extends AppException{
|
||||
/** @var string $message */
|
||||
protected $message = 'Ebook IndexableText required.';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue