mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 11:26:37 -04:00
Use Ebook::GetByIdentifier() to read ebooks
This commit is contained in:
parent
b176a68d4d
commit
1fd3688621
2 changed files with 4 additions and 8 deletions
|
@ -27,6 +27,8 @@ const MANUAL_PATH = WEB_ROOT . '/manual';
|
||||||
const EBOOKS_DIST_PATH = WEB_ROOT . '/ebooks/';
|
const EBOOKS_DIST_PATH = WEB_ROOT . '/ebooks/';
|
||||||
const COVER_ART_UPLOAD_PATH = '/images/cover-uploads/';
|
const COVER_ART_UPLOAD_PATH = '/images/cover-uploads/';
|
||||||
|
|
||||||
|
const EBOOKS_IDENTIFIER_PREFIX = 'url:https://standardebooks.org/ebooks/';
|
||||||
|
|
||||||
const DATABASE_DEFAULT_DATABASE = 'se';
|
const DATABASE_DEFAULT_DATABASE = 'se';
|
||||||
const DATABASE_DEFAULT_HOST = 'localhost';
|
const DATABASE_DEFAULT_HOST = 'localhost';
|
||||||
|
|
||||||
|
|
|
@ -39,14 +39,8 @@ try{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do we have the ebook cached?
|
$identifier = EBOOKS_IDENTIFIER_PREFIX . $urlPath;
|
||||||
try{
|
$ebook = Ebook::GetByIdentifier($identifier);
|
||||||
/** @var Ebook $ebook */
|
|
||||||
$ebook = apcu_fetch('ebook-' . $wwwFilesystemPath);
|
|
||||||
}
|
|
||||||
catch(Safe\Exceptions\ApcuException){
|
|
||||||
$ebook = Ebook::FromFilesystem($wwwFilesystemPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Divide our sources into transcriptions and scans
|
// Divide our sources into transcriptions and scans
|
||||||
foreach($ebook->Sources as $source){
|
foreach($ebook->Sources as $source){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue