mirror of
https://github.com/standardebooks/web.git
synced 2025-07-07 07:10:29 -04:00
Make MARC roles an enum and restructure how contributors are fetched from the DB to reduce queries
This commit is contained in:
parent
daf8e16ef4
commit
d6a2bdcbc8
8 changed files with 91 additions and 75 deletions
|
@ -354,7 +354,7 @@ do
|
|||
find "${workDir}"/src/epub \( -type d -name .git -prune \) -o -type f -name "*.xhtml" -print0 | xargs -0 sed --in-place --regexp-extended "s|<body([^>]*)>|<body\1><header><nav><ul><li><a href=\"/\">Standard Ebooks</a></li><li><a href=\"${bookUrl}\">Back to ebook</a></li><li><a href=\"${bookUrl}/text\">Table of contents</a></li></ul></nav></header>|"
|
||||
|
||||
# Add a chapter navigation footer to each page.
|
||||
"${scriptsDir}"/inject-chapter-navigation-footer "${workDir}" "${bookUrl}"
|
||||
#"${scriptsDir}"/inject-chapter-navigation-footer "${workDir}" "${bookUrl}"
|
||||
|
||||
# Adjust sponsored links in the colophon.
|
||||
sed --in-place 's|<p><a href="http|<p><a rel="nofollow" href="http|g' "${workDir}"/src/epub/text/colophon.xhtml
|
||||
|
|
|
@ -23,8 +23,10 @@ $types = ['epub', 'epub-advanced', 'azw3', 'kepub', 'xhtml'];
|
|||
$groups = ['collections', 'subjects', 'authors', 'months'];
|
||||
$ebooksByGroup = ['collections' => [], 'subjects' => [], 'authors' => [], 'months' => []];
|
||||
|
||||
/**
|
||||
* @see https://www.php.net/manual/en/function.rmdir.php#117354
|
||||
*/
|
||||
function rrmdir(string $src): void{
|
||||
// See <https://www.php.net/manual/en/function.rmdir.php#117354>.
|
||||
$dir = opendir($src);
|
||||
while(false !== ($file = readdir($dir))){
|
||||
if (($file != '.') && ($file != '..')){
|
||||
|
@ -94,8 +96,8 @@ function CreateZip(string $filePath, array $ebooks, string $type, string $webRoo
|
|||
|
||||
$zip->close();
|
||||
|
||||
// We have to do a copy, then unlink because rename() can't rename across file systems.
|
||||
// If the bulk downloads are symlinked to a storage volume, the rename() won't work.
|
||||
// We have to do a copy, then unlink because `rename()` can't rename across file systems.
|
||||
// If the bulk downloads are symlinked to a storage volume, then `rename()` won't work.
|
||||
copy($tempFilename, $filePath);
|
||||
unlink($tempFilename);
|
||||
|
||||
|
@ -167,7 +169,7 @@ foreach(Ebook::GetAll() as $ebook){
|
|||
}
|
||||
|
||||
// Add to the 'books by author' list.
|
||||
// We have to index by UrlName for cases like `Samuel Butler` whose UrlName is `samuel-butler-1612-1680`.
|
||||
// We have to index by `UrlName` for cases like `Samuel Butler` whose `UrlName` is `samuel-butler-1612-1680`.
|
||||
$authorsUrl = preg_replace('|^/ebooks/|', '', $ebook->AuthorsUrl);
|
||||
if(!isset($ebooksByGroup['authors'][$authorsUrl])){
|
||||
$obj = new stdClass();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue