This commit is contained in:
@ -185,6 +185,22 @@ case 'POST':
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (($body['action'] ?? '') === 'deleteAll') {
|
||||
require_role(['admin'], $tokenRec);
|
||||
$phrase = trim((string)($body['confirmPhrase'] ?? ''));
|
||||
if ($phrase !== 'DELETE ALL TRANSLATIONS') {
|
||||
json_error('CONFIRMATION_REQUIRED', 'Type DELETE ALL TRANSLATIONS to confirm', 400);
|
||||
}
|
||||
[$pdo, $tmpDb, $lockFp] = qdb_open_write_or_fail();
|
||||
try {
|
||||
$result = qdb_delete_all_translations($pdo, true);
|
||||
qdb_save($tmpDb, $lockFp);
|
||||
json_success($result);
|
||||
} catch (Throwable $e) {
|
||||
qdb_handler_fail($e, 'Delete all translations', null, $tmpDb, $lockFp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
json_error('BAD_REQUEST', 'Unknown action', 400);
|
||||
break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user