mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Work around possible MySQL bug
This commit is contained in:
parent
2acacd2647
commit
e6505a5fda
4 changed files with 12 additions and 10 deletions
|
@ -1,3 +1,9 @@
|
|||
Version 0.1?.? (2022-??-??)
|
||||
===========================
|
||||
|
||||
Bug fixes:
|
||||
- Perform MySQL table maintenance more reliably
|
||||
|
||||
Version 0.10.2 (2022-04-04)
|
||||
===========================
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ class Driver extends \JKingWeb\Arsse\Db\AbstractDriver {
|
|||
|
||||
public function maintenance(): bool {
|
||||
// with MySQL each table must be analyzed separately, so we first have to get a list of tables
|
||||
foreach ($this->query("SHOW TABLES like 'arsse\\_%'") as $table) {
|
||||
foreach ($this->query("SHOW TABLES like 'arsse%'") as $table) {
|
||||
$table = array_pop($table);
|
||||
if (!preg_match("/^arsse_[a-z_]+$/D", $table)) {
|
||||
// table is not one of ours
|
||||
|
|
|
@ -283,12 +283,8 @@ class ValueInfo {
|
|||
}
|
||||
return $out->setTimezone(new \DateTimeZone("UTC"));
|
||||
} else {
|
||||
$out = new \DateTimeImmutable($value, new \DateTimeZone("UTC"));
|
||||
if ($out) {
|
||||
return $out->setTimezone(new \DateTimeZone("UTC"));
|
||||
} elseif ($strict && !$drop) {
|
||||
throw new \Exception;
|
||||
}
|
||||
// if the string fails to parse it will produce an exception which is caught just below
|
||||
return (new \DateTimeImmutable($value, new \DateTimeZone("UTC")))->setTimezone(new \DateTimeZone("UTC"));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
if ($strict && !$drop) {
|
||||
|
|
|
@ -600,7 +600,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[[], null, null, null, null, null, null, null, null, null, null, null],
|
||||
[$this->i("P1Y2D"), null, null, null, null, null, null, null, null, null, null, null],
|
||||
["P1Y2D", null, null, null, null, null, null, null, null, null, null, null],
|
||||
] as $set) {
|
||||
] as $k => $set) {
|
||||
// shift the input value off the set
|
||||
$input = array_shift($set);
|
||||
// generate a set of tests for each target date formats
|
||||
|
@ -612,7 +612,7 @@ class TestValueInfo extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
[false, true],
|
||||
[true, true],
|
||||
] as [$strict, $drop]) {
|
||||
yield [$input, $formats[$format], $exp, $strict, $drop];
|
||||
yield "Index #$k format \"$format\" strict:$strict drop:$drop" => [$input, $formats[$format], $exp, $strict, $drop];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue