mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 03:16:36 -04:00
Get ebook from DB for artworks
This commit is contained in:
parent
c85db527cf
commit
4653b15288
2 changed files with 3 additions and 22 deletions
|
@ -259,7 +259,7 @@ class Artwork{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exceptions\AppException
|
* @throws Exceptions\EbookNotFoundException
|
||||||
*/
|
*/
|
||||||
protected function GetEbook(): ?Ebook{
|
protected function GetEbook(): ?Ebook{
|
||||||
if($this->_Ebook === null){
|
if($this->_Ebook === null){
|
||||||
|
@ -267,8 +267,8 @@ class Artwork{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$ebookWwwFilesystemPath = preg_replace('|^https://standardebooks.org/ebooks/|ius', EBOOKS_DIST_PATH, $this->EbookUrl);
|
$identifier = 'url:' . $this->EbookUrl;
|
||||||
$this->_Ebook = Library::GetEbook($ebookWwwFilesystemPath);
|
$this->_Ebook = Ebook::GetByIdentifier($identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->_Ebook;
|
return $this->_Ebook;
|
||||||
|
|
|
@ -654,25 +654,6 @@ class Library{
|
||||||
return $retval;
|
return $retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @throws Exceptions\AppException
|
|
||||||
*/
|
|
||||||
public static function GetEbook(?string $ebookWwwFilesystemPath): ?Ebook{
|
|
||||||
if($ebookWwwFilesystemPath === null){
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @var array<Ebook> $result */
|
|
||||||
$result = self::GetFromApcu('ebook-' . $ebookWwwFilesystemPath);
|
|
||||||
|
|
||||||
if(sizeof($result) > 0){
|
|
||||||
return $result[0];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws Exceptions\AppException
|
* @throws Exceptions\AppException
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue