From f9b579efc6d3116cdc322a4f8c8fe05b079d9e9c Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 10 Jul 2015 13:38:19 -0400 Subject: [PATCH] Fix sql.php behavior on error When an erroneous query is entered into sql.php, it doesn't clear its line buffer, so the intended next query (often fixing a typo in the original) winds up concatenated onto the erroneous query. Usually leading to another error, which repeats the process. The solution is simple enough: clear the line buffer unconditionally, not only when no exception is caught. Change-Id: Ia78e2df8b9c6698c0a225bfb3135274ed8da5303 --- maintenance/sql.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/maintenance/sql.php b/maintenance/sql.php index 82eae21642..a7fd827e05 100644 --- a/maintenance/sql.php +++ b/maintenance/sql.php @@ -125,12 +125,12 @@ class MwSql extends Maintenance { try { $res = $db->query( $wholeLine ); $this->sqlPrintResult( $res, $db ); - $prompt = $newPrompt; - $wholeLine = ''; } catch ( DBQueryError $e ) { $doDie = !Maintenance::posix_isatty( 0 ); $this->error( $e, $doDie ); } + $prompt = $newPrompt; + $wholeLine = ''; } wfWaitForSlaves(); } -- 2.20.1