Basically the same code has been copied and pasted in three places:
final protected function getScopedPHPBehaviorForCommit() { if ( PHP_SAPI != 'cli' ) { // https://bugs.php.net/bug.php?id=47540 $old = ignore_user_abort( true ); // avoid half-finished operations return new ScopedCallback( function () use ( $old ) { ignore_user_abort( $old ); } ); } return null; }
- FileBackend::getScopedPHPBehaviorForOps()
- LBFactory::getScopedPHPBehaviorForCommit()
- LoadBalancer::getScopedPHPBehaviorForCommit()
Let's just have it in one place, maybe it can go in the ScopedCallback library?
GCI Mentors: @Legoktm
For this task you'll need to introduce a newScopedIgnoreUserAbort function with the above code for the ScopedCallback library (mediawiki/libs/ScopedCallback in Gerrit), and then submit a second patch to the above places in MediaWiki core to use your new function.