mirror of
https://github.com/danog/telerpc.git
synced 2024-11-30 04:38:57 +01:00
Fix
This commit is contained in:
parent
2052afe6b3
commit
10e6417bc1
17
src/Main.php
17
src/Main.php
@ -263,11 +263,14 @@ final class Main
|
||||
}
|
||||
}
|
||||
|
||||
$allowed = [];
|
||||
|
||||
$q = $this->pdo->prepare('SELECT error, method FROM errors');
|
||||
$q->execute();
|
||||
$r = $q->fetchAll(PDO::FETCH_COLUMN | PDO::FETCH_GROUP);
|
||||
foreach (\array_merge($r, self::GLOBAL_CODES) as $error => $methods) {
|
||||
if (\is_int($methods)) {
|
||||
$allowed[$error] = true;
|
||||
$methods = [];
|
||||
}
|
||||
$anyok = false;
|
||||
@ -283,6 +286,7 @@ final class Main
|
||||
if (!$anyok && $methods) {
|
||||
continue;
|
||||
}
|
||||
$allowed[$error] = true;
|
||||
|
||||
$q = $this->pdo->prepare('SELECT description FROM error_descriptions WHERE error=?');
|
||||
$q->execute([$error]);
|
||||
@ -303,6 +307,19 @@ final class Main
|
||||
}
|
||||
}
|
||||
|
||||
$q = $this->pdo->prepare('SELECT error FROM error_descriptions');
|
||||
$q->execute();
|
||||
$r = $q->fetchAll(PDO::FETCH_COLUMN);
|
||||
foreach ($r as $error) {
|
||||
if (!isset($allowed[$error])) {
|
||||
$q = $this->pdo->prepare('DELETE FROM errors WHERE error=?');
|
||||
$q->execute([$error]);
|
||||
$q = $this->pdo->prepare('DELETE FROM error_descriptions WHERE error=?');
|
||||
$q->execute([$error]);
|
||||
echo 'Delete '.$error."\n";
|
||||
}
|
||||
}
|
||||
|
||||
$r = $this->v2();
|
||||
\file_put_contents('data/v2.json', \json_encode(['ok' => true, 'result' => $r]));
|
||||
[$r, $hr] = $this->v3();
|
||||
|
Loading…
Reference in New Issue
Block a user