diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b5c538ee..72c04e061 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,9 +10,12 @@ x.x.x - TODO 1.5.x - 2023xxxx Maintenance release for 1.x (PHP >= 7.4) * ... -2.x.x - 2023xxxx To be continued (PHP >= 8.1) +2.x.x - 2024xxxx To be continued (PHP >= 8.1) * TODO - Fix OPDS 2.0 pagination +2.2.2 - 20240215 Fix multi-database for epub reader and email + * Error sending or reading book from additional dbs - see issue #72 from @malkavi + 2.2.1 - 20231116 Consolidate PRs for next release (PHP >= 8.1) * Support display settings for custom columns - see pull request #69 from @Mikescher * Add Japanese language file - see pull request #67 from @horus68 translated by Rentaro Yoshidumi diff --git a/composer.lock b/composer.lock index 3536ef6b2..83bf9606f 100644 --- a/composer.lock +++ b/composer.lock @@ -165,12 +165,12 @@ "source": { "type": "git", "url": "https://github.com/nikic/FastRoute.git", - "reference": "f0708ad33ce24ec8b710d321531d0c8082454991" + "reference": "0e4448becf138690c6cbdc521175b07c2412c238" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/FastRoute/zipball/f0708ad33ce24ec8b710d321531d0c8082454991", - "reference": "f0708ad33ce24ec8b710d321531d0c8082454991", + "url": "https://api.github.com/repos/nikic/FastRoute/zipball/0e4448becf138690c6cbdc521175b07c2412c238", + "reference": "0e4448becf138690c6cbdc521175b07c2412c238", "shasum": "" }, "require": { @@ -221,7 +221,7 @@ "issues": "https://github.com/nikic/FastRoute/issues", "source": "https://github.com/nikic/FastRoute/tree/master" }, - "time": "2024-01-31T23:07:29+00:00" + "time": "2024-02-06T21:23:15+00:00" }, { "name": "npm-asset/babel--runtime", @@ -595,16 +595,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb" + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", - "reference": "ea208ce43cbb04af6867b4fdddb1bdbf84cc28cb", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/ef4d7e442ca910c4764bce785146269b30cb5fc4", + "reference": "ef4d7e442ca910c4764bce785146269b30cb5fc4", "shasum": "" }, "require": { @@ -618,9 +618,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -657,7 +654,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.29.0" }, "funding": [ { @@ -673,20 +670,20 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "42292d99c55abe617799667f454222c54c60e229" + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/42292d99c55abe617799667f454222c54c60e229", - "reference": "42292d99c55abe617799667f454222c54c60e229", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9773676c8a1bb1f8d4340a62efe641cf76eda7ec", + "reference": "9773676c8a1bb1f8d4340a62efe641cf76eda7ec", "shasum": "" }, "require": { @@ -700,9 +697,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -740,7 +734,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.29.0" }, "funding": [ { @@ -756,20 +750,20 @@ "type": "tidelift" } ], - "time": "2023-07-28T09:04:16+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "symfony/polyfill-php80", - "version": "v1.28.0", + "version": "v1.29.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5" + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/6caa57379c4aec19c0a12a38b59b26487dcfe4b5", - "reference": "6caa57379c4aec19c0a12a38b59b26487dcfe4b5", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", "shasum": "" }, "require": { @@ -777,9 +771,6 @@ }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.28-dev" - }, "thanks": { "name": "symfony/polyfill", "url": "https://github.com/symfony/polyfill" @@ -823,7 +814,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.28.0" + "source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0" }, "funding": [ { @@ -839,7 +830,7 @@ "type": "tidelift" } ], - "time": "2023-01-26T09:26:14+00:00" + "time": "2024-01-29T20:11:03+00:00" }, { "name": "twig/twig", @@ -2091,12 +2082,12 @@ "source": { "type": "git", "url": "https://github.com/php-webdriver/php-webdriver.git", - "reference": "2f8593583a7d9471a94a2f6a78c422d058387c26" + "reference": "5d8e66ff849b5614015d35e99d759252e371ce26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/2f8593583a7d9471a94a2f6a78c422d058387c26", - "reference": "2f8593583a7d9471a94a2f6a78c422d058387c26", + "url": "https://api.github.com/repos/php-webdriver/php-webdriver/zipball/5d8e66ff849b5614015d35e99d759252e371ce26", + "reference": "5d8e66ff849b5614015d35e99d759252e371ce26", "shasum": "" }, "require": { @@ -2150,7 +2141,7 @@ "issues": "https://github.com/php-webdriver/php-webdriver/issues", "source": "https://github.com/php-webdriver/php-webdriver/tree/main" }, - "time": "2024-01-10T10:54:27+00:00" + "time": "2024-02-10T13:13:15+00:00" }, { "name": "phpunit/php-code-coverage", @@ -3847,16 +3838,16 @@ }, { "name": "spatie/array-to-xml", - "version": "3.2.2", + "version": "3.2.3", "source": { "type": "git", "url": "https://github.com/spatie/array-to-xml.git", - "reference": "96be97e664c87613121d073ea39af4c74e57a7f8" + "reference": "c95fd4db94ec199f798d4b5b4a81757bd20d88ab" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/96be97e664c87613121d073ea39af4c74e57a7f8", - "reference": "96be97e664c87613121d073ea39af4c74e57a7f8", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/c95fd4db94ec199f798d4b5b4a81757bd20d88ab", + "reference": "c95fd4db94ec199f798d4b5b4a81757bd20d88ab", "shasum": "" }, "require": { @@ -3894,7 +3885,7 @@ "xml" ], "support": { - "source": "https://github.com/spatie/array-to-xml/tree/3.2.2" + "source": "https://github.com/spatie/array-to-xml/tree/3.2.3" }, "funding": [ { @@ -3906,7 +3897,7 @@ "type": "github" } ], - "time": "2023-11-14T14:08:51+00:00" + "time": "2024-02-07T10:39:02+00:00" }, { "name": "symfony/browser-kit", diff --git a/lib/Input/Config.php b/lib/Input/Config.php index 1dec93936..0e411fe54 100644 --- a/lib/Input/Config.php +++ b/lib/Input/Config.php @@ -16,7 +16,7 @@ */ class Config { - public const VERSION = '2.2.1'; + public const VERSION = '2.2.2'; public const ENDPOINT = [ "index" => "index.php", "feed" => "feed.php", diff --git a/lib/Output/EPubReader.php b/lib/Output/EPubReader.php index 6caec025a..f4f0b46e6 100644 --- a/lib/Output/EPubReader.php +++ b/lib/Output/EPubReader.php @@ -83,7 +83,7 @@ public static function getComponentContent($book, $component, $params = []) public static function getContent($idData, $component, $request) { /** @var Book */ - $book = Book::getBookByDataId($idData); + $book = Book::getBookByDataId($idData, $request->database()); $params = ['data' => $idData, 'db' => $book->getDatabaseId()]; $epub = new static::$epubClass($book->getFilePath('EPUB', $idData)); @@ -104,7 +104,7 @@ public static function getContent($idData, $component, $request) */ public static function getReader($idData, $request) { - $book = Book::getBookByDataId($idData); + $book = Book::getBookByDataId($idData, $request->database()); $params = ['data' => $idData, 'db' => $book->getDatabaseId()]; try { diff --git a/lib/Output/Mail.php b/lib/Output/Mail.php index f49321028..560dda31b 100644 --- a/lib/Output/Mail.php +++ b/lib/Output/Mail.php @@ -10,6 +10,7 @@ namespace SebLucas\Cops\Output; use SebLucas\Cops\Input\Config; +use SebLucas\Cops\Input\Request; use PHPMailer\PHPMailer\PHPMailer; use SebLucas\Cops\Calibre\Book; @@ -59,12 +60,13 @@ public static function checkRequest($idData, $emailDest) * Summary of sendMail * @param mixed $idData * @param string $emailDest + * @param Request $request * @param bool $dryRun * @return bool|string */ - public static function sendMail($idData, $emailDest, $dryRun = false) + public static function sendMail($idData, $emailDest, $request, $dryRun = false) { - $book = Book::getBookByDataId($idData); + $book = Book::getBookByDataId($idData, $request->database()); $data = $book->getDataById($idData); if (!file_exists($data->getLocalPath())) { diff --git a/sendtomail.php b/sendtomail.php index e791cb00a..27407a87c 100644 --- a/sendtomail.php +++ b/sendtomail.php @@ -18,7 +18,7 @@ exit; } -if ($error = Mail::sendMail($idData, $emailDest)) { +if ($error = Mail::sendMail($idData, $emailDest, $request)) { echo localize("mail.messagenotsent"); echo $error; exit; diff --git a/test/mailTest.php b/test/mailTest.php index 6259fe546..8e33043dc 100644 --- a/test/mailTest.php +++ b/test/mailTest.php @@ -11,6 +11,7 @@ require_once __DIR__ . '/config_test.php'; use PHPUnit\Framework\TestCase; use SebLucas\Cops\Input\Config; +use SebLucas\Cops\Input\Request; use SebLucas\Cops\Output\Mail; class MailTest extends TestCase @@ -104,21 +105,24 @@ public function testCheckRequestEmailNotValid(): void public function testSendMailNotFound(): void { - $this->assertStringStartsWith("No", Mail::sendMail(12, "a@a.com")); + $request = Request::build([]); + $this->assertStringStartsWith("No", Mail::sendMail(12, "a@a.com", $request)); } public function testSendMailTooBig(): void { $old = Mail::$maxSize; Mail::$maxSize = 0; - $this->assertStringStartsWith("No", Mail::sendMail(20, "a@a.com")); + $request = Request::build([]); + $this->assertStringStartsWith("No", Mail::sendMail(20, "a@a.com", $request)); Mail::$maxSize = $old; } public function testSendMailSomeday(): void { + $request = Request::build([]); // use dryRun to run preSend() but not actually Send() - $error = Mail::sendMail(20, "a@a.com", true); + $error = Mail::sendMail(20, "a@a.com", $request, true); $this->assertFalse($error); } } diff --git a/test/pageMultidatabaseTest.php b/test/pageMultidatabaseTest.php index 3af6fe217..d3d10b4bd 100644 --- a/test/pageMultidatabaseTest.php +++ b/test/pageMultidatabaseTest.php @@ -83,6 +83,7 @@ public function providerSearch() public static function tearDownAfterClass(): void { + Config::set('calibre_directory', __DIR__ . "/BaseWithSomeBooks/"); Database::clearDb(); } }