Commit DB changes as normal on exception-based GUI errors
authorAaron Schulz <aschulz@wikimedia.org>
Mon, 3 Mar 2014 21:12:11 +0000 (13:12 -0800)
committerOri.livneh <ori@wikimedia.org>
Mon, 14 Apr 2014 16:51:55 +0000 (16:51 +0000)
Bug: 62091
Change-Id: I36cd645d5f7a939b60f306e5fc093507693b097b

includes/Wiki.php

index fbafba8..9e8c720 100644 (file)
@@ -444,7 +444,15 @@ class MediaWiki {
        public function run() {
                try {
                        $this->checkMaxLag();
-                       $this->main();
+                       try {
+                               $this->main();
+                       } catch ( ErrorPageError $e ) {
+                               // Bug 62091: while exceptions are convenient to bubble up GUI errors,
+                               // they are not internal application faults. As with normal requests, this
+                               // should commit, print the output, do deferred updates, jobs, and profiling.
+                               wfGetLBFactory()->commitMasterChanges();
+                               $e->report(); // display the GUI error
+                       }
                        if ( function_exists( 'fastcgi_finish_request' ) ) {
                                fastcgi_finish_request();
                        }