mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Fix MySQL failure and shore up coverage
This marks the end of the feed reduplication effort
This commit is contained in:
parent
eed42ddf19
commit
bbdc4f7672
5 changed files with 19 additions and 11 deletions
|
@ -38,7 +38,7 @@ abstract class AbstractException extends \Exception {
|
||||||
"Db/Exception.updateFileUnreadable" => 10216,
|
"Db/Exception.updateFileUnreadable" => 10216,
|
||||||
"Db/Exception.updateFileError" => 10217,
|
"Db/Exception.updateFileError" => 10217,
|
||||||
"Db/Exception.updateFileIncomplete" => 10218,
|
"Db/Exception.updateFileIncomplete" => 10218,
|
||||||
"Db/Exception.updateSchemaChange" => 10219,
|
"Db/Exception.updateSchemaDowngrade" => 10219,
|
||||||
"Db/Exception.paramTypeInvalid" => 10221,
|
"Db/Exception.paramTypeInvalid" => 10221,
|
||||||
"Db/Exception.paramTypeUnknown" => 10222,
|
"Db/Exception.paramTypeUnknown" => 10222,
|
||||||
"Db/Exception.paramTypeMissing" => 10223,
|
"Db/Exception.paramTypeMissing" => 10223,
|
||||||
|
|
|
@ -84,8 +84,9 @@ class Database {
|
||||||
if ($initialize) {
|
if ($initialize) {
|
||||||
if ($ver < self::SCHEMA_VERSION) {
|
if ($ver < self::SCHEMA_VERSION) {
|
||||||
$this->db->schemaUpdate(self::SCHEMA_VERSION);
|
$this->db->schemaUpdate(self::SCHEMA_VERSION);
|
||||||
} elseif ($ver != self::SCHEMA_VERSION) {
|
} elseif ($ver != self::SCHEMA_VERSION) {// @codeCoverageIgnore
|
||||||
throw new Db\Exception("updateSchemaChange");
|
// This will only occur if an old version of the software is used with a newer database schema
|
||||||
|
throw new Db\Exception("updateSchemaDowngrade"); // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1151,7 +1152,6 @@ class Database {
|
||||||
try {
|
try {
|
||||||
$keep = Rule::prep($sub['keep']);
|
$keep = Rule::prep($sub['keep']);
|
||||||
$block = Rule::prep($sub['block']);
|
$block = Rule::prep($sub['block']);
|
||||||
$feed = $sub['id'];
|
|
||||||
} catch (RuleException $e) { // @codeCoverageIgnore
|
} catch (RuleException $e) { // @codeCoverageIgnore
|
||||||
// invalid rules should not normally appear in the database, but it's possible
|
// invalid rules should not normally appear in the database, but it's possible
|
||||||
// in this case we should halt evaluation and just leave things as they are
|
// in this case we should halt evaluation and just leave things as they are
|
||||||
|
@ -1277,13 +1277,17 @@ class Database {
|
||||||
// prepare the keep and block rules
|
// prepare the keep and block rules
|
||||||
try {
|
try {
|
||||||
$keep = Rule::prep($f['keep_rule'] ?? "");
|
$keep = Rule::prep($f['keep_rule'] ?? "");
|
||||||
} catch (RuleException $e) {
|
} catch (RuleException $e) { // @codeCoverageIgnore
|
||||||
$keep = "";
|
// invalid rules should not normally appear in the database, but it's possible
|
||||||
|
// in this case we act as if the rule were not defined
|
||||||
|
$keep = ""; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$block = Rule::prep($f['block_rule'] ?? "");
|
$block = Rule::prep($f['block_rule'] ?? "");
|
||||||
} catch (RuleException $e) {
|
} catch (RuleException $e) { // @codeCoverageIgnore
|
||||||
$block = "";
|
// invalid rules should not normally appear in the database, but it's possible
|
||||||
|
// in this case we act as if the rule were not defined
|
||||||
|
$block = ""; // @codeCoverageIgnore
|
||||||
}
|
}
|
||||||
// determine if the feed icon needs to be updated, and update it if appropriate
|
// determine if the feed icon needs to be updated, and update it if appropriate
|
||||||
$tr = $this->db->begin();
|
$tr = $this->db->begin();
|
||||||
|
@ -2473,10 +2477,13 @@ class Database {
|
||||||
* @param boolean $includeEmpty Whether to include (true) or supress (false) tags which have no subscriptions assigned to them
|
* @param boolean $includeEmpty Whether to include (true) or supress (false) tags which have no subscriptions assigned to them
|
||||||
*/
|
*/
|
||||||
public function tagList(string $user, bool $includeEmpty = true): Db\Result {
|
public function tagList(string $user, bool $includeEmpty = true): Db\Result {
|
||||||
|
$integerType = $this->db->sqlToken("integer");
|
||||||
return $this->db->prepareArray(
|
return $this->db->prepareArray(
|
||||||
"SELECT * FROM (
|
"SELECT * FROM (
|
||||||
SELECT
|
SELECT
|
||||||
id,name,coalesce(subscriptions,0) as subscriptions
|
id,
|
||||||
|
name,
|
||||||
|
cast(coalesce(subscriptions,0) as $integerType) as subscriptions -- this cast is required for MySQL for unclear reasons
|
||||||
from arsse_tags
|
from arsse_tags
|
||||||
left join (
|
left join (
|
||||||
SELECT
|
SELECT
|
||||||
|
|
|
@ -147,7 +147,7 @@ return [
|
||||||
0 {Automatic updating of the {driver_name} database failed because it is already up to date with the requested version, {target}}
|
0 {Automatic updating of the {driver_name} database failed because it is already up to date with the requested version, {target}}
|
||||||
other {Automatic updating of the {driver_name} database failed because its version, {current}, is newer than the requested version, {target}}
|
other {Automatic updating of the {driver_name} database failed because its version, {current}, is newer than the requested version, {target}}
|
||||||
}',
|
}',
|
||||||
'Exception.JKingWeb/Arsse/Db/Exception.updateSchemaChange' => 'Database schema version is newer than the application schema version',
|
'Exception.JKingWeb/Arsse/Db/Exception.updateSchemaDowngrade' => 'Database schema version is newer than the application schema version',
|
||||||
'Exception.JKingWeb/Arsse/Db/Exception.engineErrorGeneral' => '{0}',
|
'Exception.JKingWeb/Arsse/Db/Exception.engineErrorGeneral' => '{0}',
|
||||||
// indicates programming error
|
// indicates programming error
|
||||||
'Exception.JKingWeb/Arsse/Db/Exception.savepointStatusUnknown' => 'Savepoint status code {0} not implemented',
|
'Exception.JKingWeb/Arsse/Db/Exception.savepointStatusUnknown' => 'Savepoint status code {0} not implemented',
|
||||||
|
|
|
@ -815,7 +815,7 @@ trait SeriesArticle {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMarkMultipleMissingEditions(): void {
|
public function testMarkMultipleMissingEditions(): void {
|
||||||
$this->assertSame(0, Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editions([500,501])));
|
$this->assertSame(0, Arsse::$db->articleMark($this->user, ['starred' => true], (new Context)->editions([56458, 1851855])));
|
||||||
$state = $this->primeExpectations($this->data, $this->checkTables);
|
$state = $this->primeExpectations($this->data, $this->checkTables);
|
||||||
$this->compareExpectations(static::$drv, $state);
|
$this->compareExpectations(static::$drv, $state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -531,6 +531,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
||||||
[$this->i("P2DT1H"), [null,true], [true, false], [(48 + 1) * 60 * 60, false], [1.0 * (48 + 1) * 60 * 60, false], ["P2DT1H", true], [[$this->i("P2DT1H")], false], [$this->i("P2DT1H"), true]],
|
[$this->i("P2DT1H"), [null,true], [true, false], [(48 + 1) * 60 * 60, false], [1.0 * (48 + 1) * 60 * 60, false], ["P2DT1H", true], [[$this->i("P2DT1H")], false], [$this->i("P2DT1H"), true]],
|
||||||
[$this->i("PT0H"), [null,true], [true, false], [0, false], [0.0, false], ["PT0S", true], [[$this->i("PT0H")], false], [$this->i("PT0H"), true]],
|
[$this->i("PT0H"), [null,true], [true, false], [0, false], [0.0, false], ["PT0S", true], [[$this->i("PT0H")], false], [$this->i("PT0H"), true]],
|
||||||
[$dateDiff, [null,true], [true, false], [366 * 24 * 60 * 60, false], [1.0 * 366 * 24 * 60 * 60, false], ["P366D", true], [[$dateDiff], false], [$dateNorm, true]],
|
[$dateDiff, [null,true], [true, false], [366 * 24 * 60 * 60, false], [1.0 * 366 * 24 * 60 * 60, false], ["P366D", true], [[$dateDiff], false], [$dateNorm, true]],
|
||||||
|
["1 year, 2 days", [null,true], [true, false], [0, false], [0.0, false], ["1 year, 2 days", true], [["1 year, 2 days"], false], [\DateInterval::createFromDateString("1 year, 2 days"), false]],
|
||||||
["P1Y2D", [null,true], [true, false], [0, false], [0.0, false], ["P1Y2D", true], [["P1Y2D"], false], [$this->i("P1Y2D"), true]],
|
["P1Y2D", [null,true], [true, false], [0, false], [0.0, false], ["P1Y2D", true], [["P1Y2D"], false], [$this->i("P1Y2D"), true]],
|
||||||
] as $set) {
|
] as $set) {
|
||||||
// shift the input value off the set
|
// shift the input value off the set
|
||||||
|
|
Loading…
Reference in a new issue