Commit graph

1901 commits

Author SHA1 Message Date
Mike Colagrosso
d9b6e3020c IndexableText improvements
Description and LongDescription were adding too many extraneous matches. Maintain
how special characters are handled in search currently.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
4abf6e29d2 Add an index for EbookCreated
This is the default sort on /ebooks, so it should have an index
2024-11-04 13:16:56 -06:00
Mike Colagrosso
be6873d21d Remove distinct from query in GetEbookCollections
The point of the commits in #374, e.g., the new `CollectionEbooks` table, was so that `distinct` wasn't needed.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
50aa81cb29 Create a helper function for SQL set membership 2024-11-04 13:16:56 -06:00
Mike Colagrosso
44dc65005d Query Contributors table for GetEbooksByAuthor() 2024-11-04 13:16:56 -06:00
Mike Colagrosso
2d5e66f2f2 Get carousel books from the DB 2024-11-04 13:16:56 -06:00
Mike Colagrosso
402dae95ff Add a Type enum to Tags for artwork/ebook 2024-11-04 13:16:56 -06:00
Mike Colagrosso
ee29c526f8 Add a CollectionMembership class 2024-11-04 13:16:56 -06:00
Mike Colagrosso
a25660bc8b Split Collections into two tables 2024-11-04 13:16:56 -06:00
Mike Colagrosso
d5748d1006 update-ebook-database: Keys aren't always integers 2024-11-04 13:16:56 -06:00
Mike Colagrosso
4d321061c5 Use ::class names instead of strings in LocSubject and EbookTag 2024-11-04 13:16:56 -06:00
Mike Colagrosso
43416e76db Get list of tags from DB 2024-11-04 13:16:56 -06:00
Mike Colagrosso
b3a173aa91 Get ebooks in a collection from DB 2024-11-04 13:16:56 -06:00
Mike Colagrosso
da68637ba0 Get list of collections from DB 2024-11-04 13:16:56 -06:00
Mike Colagrosso
4653b15288 Get ebook from DB for artworks 2024-11-04 13:16:56 -06:00
Mike Colagrosso
c85db527cf Get ebook from DB for downloads 2024-11-04 13:16:56 -06:00
Mike Colagrosso
252d17340f Fix bug from porting the logic from TitleWithCreditsHtml and ContributorsHtml 2024-11-04 13:16:56 -06:00
Mike Colagrosso
415faeb19d Remove unused import that should have been in #371 2024-11-04 13:16:56 -06:00
Mike Colagrosso
1fd3688621 Use Ebook::GetByIdentifier() to read ebooks 2024-11-04 13:16:56 -06:00
Mike Colagrosso
b176a68d4d Replace TextSinglePageSizeNumber and TextSinglePageSizeUnit with TextSinglePageSizeFormatted 2024-11-04 13:16:56 -06:00
Mike Colagrosso
1589dda35c Correct errors found in #336 2024-11-04 13:16:56 -06:00
Mike Colagrosso
4e7f6cfc88 Adds a validator in ./scripts/update-ebook-db to compare
It compares objects from `Ebook::FromFilesystem()` and `Ebook::GetByIdentifier()` to confirm there are no differences.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
fc4a509b0d Don't call update-ebook-database with verbose flag
`./scripts/update-ebook-database --verbose` should be for low-level debugging only
2024-11-04 13:16:56 -06:00
Mike Colagrosso
2098b265a8 Rename the constructor Ebook::__construct() to static Ebook::FromFilesystem()
Also added `GetFoo()` methods for all the derived properties like `GetUrl()`, `GetHasDownloads()`, etc. Removed that logic from the constructor so that it's reusable in `Ebook::FromFilesystem()` and `Ebook::GetByIdentifier()`
2024-11-04 13:16:56 -06:00
Mike Colagrosso
f605a4df60 Rename Created and Updated in PHP code to EbookCreated and EbookUpdated to match the schema 2024-11-04 13:16:56 -06:00
Mike Colagrosso
ac7db8d375 Add primary keys to LocSubjects and Tags tables
Missed these before, and in addition to being a good practice, they are needed to maintain insertion order of LocSubjects and Tags.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
dc62553269 Remove leading slash from exceptions in lib/Exceptions 2024-11-04 13:16:56 -06:00
Mike Colagrosso
5c69923176 Workaround a bug in Safe-PHP causes PHPStan errors 2024-11-04 13:16:56 -06:00
Mike Colagrosso
72d679a04f Fix PHPStan errors 2024-11-04 13:16:56 -06:00
Mike Colagrosso
79daa82bf4 Add primary keys to multiple tables
I missed these keys when creating the initial schema, and it's a useful practice.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
032032b920 Additional Ebook validation 2024-11-04 13:16:56 -06:00
Mike Colagrosso
3ef1af1237 Add @throws to Ebook::GetByIdentifier 2024-11-04 13:16:56 -06:00
Mike Colagrosso
196f5ae573 Ebook::GetByIdentifier can't return null 2024-11-04 13:16:56 -06:00
Mike Colagrosso
572fd90fed Replace Library::GetEbookByIdentifier with Ebook::GetByIdentifier
The new method throws an exception instead of returning null.
2024-11-04 13:16:56 -06:00
Mike Colagrosso
7350891cd5 Spell out EbookSourceType values 2024-11-04 13:16:56 -06:00
Mike Colagrosso
f736c20e3b Fix error found by PHPStan
PHPStan doesn't think that Identifier can be null:

```
549    Strict comparison using === between string and null will always evaluate to false.
```
2024-11-04 13:16:56 -06:00
Mike Colagrosso
88b3ffd9ed Store EbookSourceType as a string/enum, not int 2024-11-04 13:16:56 -06:00
Mike Colagrosso
cc8de11ca4 Replace static GetOrCreate with GetByNameOrCreate 2024-11-04 13:16:56 -06:00
Mike Colagrosso
4a1a4efb24 Don't redine Name in LocSubject, already in Tag 2024-11-04 13:16:56 -06:00
Mike Colagrosso
1e0d591066 Set ebookWwwFilesystemPath default to null 2024-11-04 13:16:56 -06:00
Mike Colagrosso
8599dfcc09 Show both long and short flag options 2024-11-04 13:16:56 -06:00
Mike Colagrosso
254bf8b3d7 Put shell variable in quotes 2024-11-04 13:16:56 -06:00
Mike Colagrosso
41b130195f Change size checks (like bigger than 3 MB) to use TextSinglePageByteCount, not number and units 2024-11-04 13:16:56 -06:00
Mike Colagrosso
ccd73c7cb4 Initial script to insert/update Ebook records 2024-11-04 13:16:56 -06:00
Mike Colagrosso
63d411a2e6 Initial code changes to insert/update Ebook records 2024-11-04 13:16:56 -06:00
Mike Colagrosso
073f138c47 Initial Ebook DB schema 2024-11-04 13:16:56 -06:00
Alex Cabal
f97539f399 Redirect an artwork if it's found under an artist's alternate name. 2024-11-03 15:15:07 -06:00
Robin Whittleton
71c2dfc55b Add missing php-mysql to README
Without this the site can’t connect to the database.
2024-10-28 13:16:25 -05:00
Robin Whittleton
758cfc684b Update Dockerfile to work with MariaDB 2024-10-28 13:16:25 -05:00
Robin Whittleton
ef2356df99 Note that our newsletter sign-up page isn’t accessible 2024-10-28 11:12:14 -05:00