From: Aaron Schulz Date: Wed, 12 Aug 2015 23:08:14 +0000 (-0700) Subject: Try to make POSTs as transactional as possible X-Git-Tag: 1.31.0-rc.0~10442 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=66e723e6beeb75ffc0fd3b568d876de736492be2;p=lhc%2Fweb%2Fwiklou.git 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 --- 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