Commit graph

1893 commits

Author SHA1 Message Date
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
Hendrik
50bfb82a65 Add some spreadsheets and change links of others 2024-10-25 22:25:05 -05:00
erin
683117473d Add Nella Larsen Short Fiction spreadsheet 2024-10-25 11:44:05 -05:00
EmmaSweeney
35b4c2ce88 Correct figure in play how-to guide 2024-10-24 18:53:34 -04:00
Alex Cabal
88c3049d7a Change some datetime columns to timestamp 2024-10-24 16:37:09 -05:00
Alex Cabal
028c8237a5 Add short fiction spreadsheet 2024-10-24 12:31:01 -05:00
EmmaSweeney
8d70ef1be1 Update play how-to guide 2024-10-23 22:28:22 -04:00
Alex Cabal
82e43cb520 Add DB setup to readme 2024-10-23 11:09:16 -05:00
Alex Cabal
b6fbcaba26 Remove irrelevant user from SQL config 2024-10-22 22:47:56 -05:00