Commit graph

136 commits

Author SHA1 Message Date
Alex Cabal
a1da50fc1a Sort projects by ebook title 2024-12-18 14:28:07 -06:00
Alex Cabal
b2191d1219 Allow editing of projects 2024-12-18 14:20:28 -06:00
Mike Colagrosso
f449c024ea Add /edit endpoint to update placeholders 2024-12-18 12:58:18 -06:00
Alex Cabal
c7a4e34e31 Add projects index page, and more detail on placeholder pages 2024-12-14 21:12:00 -06:00
Alex Cabal
adfe07aad9 Add beginning of a project management system to placeholders 2024-12-14 19:13:03 -06:00
Alex Cabal
e56de4b19d Switch from EbookPlaceholder.Status to EbookPlaceholder.IsInProgress, and some type tweaks 2024-12-14 13:39:28 -06:00
Alex Cabal
1a742baa51 Add CanEditEbooks benefit and clean up some PHPStan errors 2024-12-14 11:50:16 -06:00
Alex Cabal
23b5c8ef31 Allow admin to view collection metadata 2024-12-14 11:32:02 -06:00
Alex Cabal
79fdc8c20f Some type check fixes 2024-12-13 23:21:04 -06:00
Alex Cabal
89d0b2ea46 Replace ' with ’ in placeholder titles 2024-12-13 12:24:29 -06:00
Mike Colagrosso
1ab95df084 Add placeholders for ebooks 2024-12-13 11:46:36 -06:00
Alex Cabal
77540dacbb Clarify comments 2024-12-05 11:22:53 -06:00
Alex Cabal
f9b3d09c7d Code formatting 2024-11-28 12:12:00 -06:00
Alex Cabal
347f166e8a Catch rare exception when searching ebooks 2024-11-28 12:10:53 -06:00
Alex Cabal
3f822b85c3 Add PHPDocs and code formatting 2024-11-20 14:23:42 -06:00
Alex Cabal
d4c7703cf0 Restructure how incorrect ebook URLs are redirected 2024-11-11 13:59:45 -06:00
Alex Cabal
d6a2bdcbc8 Make MARC roles an enum and restructure how contributors are fetched from the DB to reduce queries 2024-11-11 12:01:53 -06:00
Alex Cabal
b7b63a4be5 Refactor functions out of Library 2024-11-10 23:05:31 -06:00
Alex Cabal
acb30b897c Add PropertyFromHttp trait and update codebase to use new pattern 2024-11-10 22:23:43 -06:00
Alex Cabal
be5574eaec Move enums into their own namespace 2024-11-08 16:34:21 -06:00
Alex Cabal
d03d9782d1 Fixes for PD Day placeholder ebooks 2024-11-07 20:15:20 -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
Mike Colagrosso
7e67e108f3 Update some comments 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
d22bdc0099 Remove use of Safe\sprintf 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
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
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
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
8a61713fa4 Ebook validation: Trim properties that are present 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
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
b792dec9e5 Make collection type (series, set) an enum 2024-11-04 13:16:56 -06:00
Mike Colagrosso
c8d5dfb11f Add properties that were previously omitted
PHP 8.3 (part of Ubuntu 24.04) outputs a deprecated warning for properties that
were not in the class definition. Error below. There were a few of these
missing from the `Ebook`, `GitCommit`, `CollectionMembership`, `EbookSource`,
and `Contributor` classes. Adding them doesn't change any functionality, but it
does make it clearer what properties a class has.

Some of these properties are never set for `Ebook` instances created from the
filesystem, i.e., `Created` and `Updated`, and some of them need to be manually
set to make `Ebook` instances from the filesystem and the database match, e.g.,
`GitCommitId`, `CollectionEbookId`, `EbookSourceId`, and `ContributorId`.
Making the `Ebook` instances from the filesystem and the database match each
other makes it easier to spot bugs in the future.

Previous errors with PHP 8.3:

```
PHP Deprecated:  Creation of dynamic property Ebook::$Created is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property Ebook::$Updated is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$GitCommitId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property GitCommit::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property CollectionMembership::$CollectionEbookId is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property CollectionMembership::$EbookId is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property CollectionMembership::$CollectionId is deprecated in /standardebooks.org/web/lib/Traits/Accessor.php on line 42
PHP Deprecated:  Creation of dynamic property EbookSource::$EbookSourceId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property EbookSource::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property EbookSource::$EbookSourceId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property EbookSource::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property Contributor::$ContributorId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property Contributor::$EbookId is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
PHP Deprecated:  Creation of dynamic property Contributor::$SortOrder is deprecated in /standardebooks.org/web/lib/DbConnection.php on line 286
```
2024-11-04 13:16:56 -06:00
Mike Colagrosso
6c8e819316 Implement OpenSearch feed search with FilterEbooks 2024-11-04 13:16:56 -06:00
Mike Colagrosso
e06fd910ed Removed unused function Ebook::IsInCollection() 2024-11-04 13:16:56 -06:00
Mike Colagrosso
e5fc21ffd3 Remove unneeded HasTag() method
It was used in APCu search before the DB
2024-11-04 13:16:56 -06:00