From: Brad Jorsch Date: Fri, 10 Jul 2015 17:38:19 +0000 (-0400) Subject: Fix sql.php behavior on error X-Git-Tag: 1.31.0-rc.0~10819 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=f9b579efc6d3116cdc322a4f8c8fe05b079d9e9c;p=lhc%2Fweb%2Fwiklou.git 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 --- 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(); }