From 66e723e6beeb75ffc0fd3b568d876de736492be2 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Wed, 12 Aug 2015 16:08:14 -0700 Subject: [PATCH] Try to make POSTs as transactional as possible * WMF has has ignore_user_abort() for *all* request in configuration for many years. This brings this to default MediaWiki for all POST requests, which are likely to do writes. Of course, some do not, notably parse requests and previews, since GET cannot carry the payload. Avoiding data corruption is more important though. Bug: T102890 Change-Id: I11c8b0d99583a682f756cef9747ec5ba9751c5e3 --- includes/WebStart.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/includes/WebStart.php b/includes/WebStart.php index f97dc6a94f..80db15b139 100644 --- a/includes/WebStart.php +++ b/includes/WebStart.php @@ -136,3 +136,8 @@ if ( ob_get_level() == 0 ) { if ( !defined( 'MW_NO_SETUP' ) ) { require_once "$IP/includes/Setup.php"; } + +# Multiple DBs or commits might be used; keep the request as transactional as possible +if ( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD'] === 'POST' ) { + ignore_user_abort( true ); +} \ No newline at end of file -- 2.20.1