Commit graph

1969 commits

Author SHA1 Message Date
Alex Cabal
a8e381b2a5 Add more PD day 2025 books 2024-11-07 19:13:59 -06:00
Alex Cabal
e234a71968 Update wanted ebooks list 2024-11-06 11:30:41 -06:00
Alex Cabal
8f17f39e1b Clean up some PD day code 2024-11-05 16:01:44 -06:00
brendan
5966657b1b Fix typo 2024-11-05 15:59:55 -06:00
Alex Cabal
274605a0e8 Fix incorrect filesystem determination and simplify hash calculation 2024-11-05 14:04:56 -06:00
Alex Cabal
163ada3b09 Add placeholders for public domain day ebooks 2024-11-04 21:17:09 -06:00
Alex Cabal
60f0ea16cb Formatting tweaks 2024-11-04 13:31:17 -06:00
Mike Colagrosso
0138b19000 Make Artwork robust to EbookNotFoundException
This probably means the Ebook is unreleased, but the artwork page can still show the EbookUrl.

Found this error during testing of the ebook DB here:

https://github.com/standardebooks/web/pull/401#issuecomment-2450588117
2024-11-04 13:16:56 -06:00
Mike Colagrosso
7e67e108f3 Update some comments 2024-11-04 13:16:56 -06:00
Mike Colagrosso
79533398ef Add anchor to the start of preg_match()
Should have added these with bf631682
2024-11-04 13:16:56 -06:00
Mike Colagrosso
19032b0bc2 Clarify EBOOK_SINGLE_PAGE_SIZE_WARNING 2024-11-04 13:16:56 -06:00
Mike Colagrosso
312e2105ec Change Created datetime to timestamp to match 88c3049 2024-11-04 13:16:56 -06:00
Mike Colagrosso
c3c4cbddca Adopt IF NOT EXISTS approach from 82e43cb 2024-11-04 13:16:56 -06:00
Mike Colagrosso
65d1dcdd88 Use the NOW constant from eec7971 2024-11-04 13:16:56 -06:00
Mike Colagrosso
df8eac6f82 Rename GitCommit::FromLogLine and have it accept the full line 2024-11-04 13:16:56 -06:00
Mike Colagrosso
e9cf55b53f Remove EbookSource::FromTypeAndUrl() 2024-11-04 13:16:56 -06:00
Mike Colagrosso
6bec232d37 Remove checks against EBOOK_EARLIEST_CREATION_DATE 2024-11-04 13:16:56 -06:00
Mike Colagrosso
432723eafe Correct return type and typo in GetUrl() 2024-11-04 13:16:56 -06:00
Mike Colagrosso
7253ad41ca Rename flag to --ebook-www-filesystem-path 2024-11-04 13:16:56 -06:00
Mike Colagrosso
627f90c0e2 Add try/catch around Ebook::FromFilesystem() 2024-11-04 13:16:56 -06:00
Mike Colagrosso
d22bdc0099 Remove use of Safe\sprintf 2024-11-04 13:16:56 -06:00
Mike Colagrosso
95a1edc8b7 Bump TocEntries.SortOrder from tinyint to smallint
Ebooks can have more than 255 TocEntries. (572 is the current highest.)
2024-11-04 13:16:56 -06:00
Mike Colagrosso
c8e6524ef2 Remove primary key TocEntryId
Add a SortOrder column to order the TocEntries instead.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
2eb7fef027 Remove primary key GitCommitId
The table already has a Created column, and that's the column we use to sort on.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
3f3cf702b2 Remove primary key ContributorId
`Ebook` to `Contributor` is one to many, and we don't query by ContributorId.
The table already has a SortOrder column, and we use that to order the queries.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
1076c9a77d Remove primary key EbookSourceId
There is a one to many relationship between `Ebook` and `EbookSource`, and we
don't query by `EbookSourceId`. We add a `SortOrder` column to keep the sources
in the same order as specified in `content.opf`.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
4e8ba5ddaa Remove primary key EbookTagId
Add a SortOrder column so that tags are presented in the same order as listed in content.opf.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
b4b6fde778 Remove primary key EbookLocSubjectId
Add a SortOrder column to keep the LocSubjects in the same order as given in content.opf.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
cada95383f Remove primary key CollectionEbookId
Add a SortOrder to preserve the order of the collections listed in content.opf for ebook.php, e.g., for To the Lighthouse:

№ 15 in the Modern Library’s 100 Best Novels set.
Part of the Encyclopædia Britannica’s Great Books of the Western World set.
№ 2 in the BBC’s 100 Greatest British Novels (2015) set.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
4a7483411a Remove unused reference to preg_replace 2024-11-04 13:16:56 -06:00
Mike Colagrosso
d0926370be Add check for DuplicateDatabaseKeyException
when inserting into join tables EbookTags, EbookLocSubjects, CollectionEbooks
2024-11-04 13:16:56 -06:00
Mike Colagrosso
38860c4729 Rename Insert*Strings() to Create*()
Also rename:

Insert*() to Add*()
Delete*() to Remove*()
2024-11-04 13:16:56 -06:00
Mike Colagrosso
16c7c2ffd8 Anchor on beginning or ending in preg_match() 2024-11-04 13:16:56 -06:00
Mike Colagrosso
66021f8d00 Fix mistake when printing a single exception 2024-11-04 13:16:56 -06:00
Mike Colagrosso
d952d63ee9 Add the exception's class name when printing validation exceptions 2024-11-04 13:16:56 -06:00
Mike Colagrosso
ef3eae0da5 Catch ValidationExceptions and print them nicely and remove the findObjectDifferences() function that found differences 2024-11-04 13:16:56 -06:00
Mike Colagrosso
85307a7c7e Standardize trim and other validation of nullable and non-nullable properties 2024-11-04 13:16:56 -06:00
Mike Colagrosso
0eaf2e8e47 Handle nullable and non-nullable validation consistently 2024-11-04 13:16:56 -06:00
Mike Colagrosso
783a41a1ba Make Ebook Language NOT NULL 2024-11-04 13:16:56 -06:00
Mike Colagrosso
8a61713fa4 Ebook validation: Trim properties that are present 2024-11-04 13:16:56 -06:00
Mike Colagrosso
221c2ff347 Validate Collection name 2024-11-04 13:16:56 -06:00
Mike Colagrosso
2aae231710 EbookTag validation: Trim name and check for empty string 2024-11-04 13:16:56 -06:00
Mike Colagrosso
93857641de Clean up line breaks on DELETE statements 2024-11-04 13:16:56 -06:00
Mike Colagrosso
2378320d0c Contributor, EbookSource, GitCommit: Move INSERT statements to Create() methods 2024-11-04 13:16:56 -06:00
Mike Colagrosso
4aefe412f9 Pass enum to Db::Query, not its value 2024-11-04 13:16:56 -06:00
Mike Colagrosso
2273367c6d Collection validation: Pass enum to InvalidCollectionTypeException, not value 2024-11-04 13:16:56 -06:00
Mike Colagrosso
754fc0ab2b LocSubject: Trim Name and validate Name isn't empty 2024-11-04 13:16:56 -06:00
Mike Colagrosso
5b1bb2a9f0 Change tag type from string to enum (TagType) 2024-11-04 13:16:56 -06:00
Mike Colagrosso
59eee3cc57 Explicitly set sort order for sources, contributors, and toc entries
This is just to avoid any future undefined behavior. The current DB table implementation returns these rows in insertion order, but it might not be wise to depend on that. Either way, the result sets of these queries are small and can be sorted quickly.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
7d8cfd351e Ebook tags: Store UrlName so it can be queried 2024-11-04 13:16:56 -06:00