Try to make POSTs as transactional as possible
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 12 Aug 2015 23:08:14 +0000 (16:08 -0700)
committerOri.livneh <ori@wikimedia.org>
Wed, 12 Aug 2015 23:56:59 +0000 (23:56 +0000)
* 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

index f97dc6a..80db15b 100644 (file)
@@ -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