Wikimedia
getScopedPHPBehaviorForCommit should not be copied 3 times in MediaWiki
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?
You are expected to provide two patches in Wikimedia Gerrit:
You'll need to introduce a newScopedIgnoreUserAbort
function with the above code for the ScopedCallback library (mediawiki/libs/ScopedCallback
repository in Gerrit).
Then submit a second patch to the above places in MediaWiki core to use your new function.
See https://www.mediawiki.org/wiki/Gerrit/Tutorial for how to set up Git and Gerrit.
Task tags
Students who completed this task
stibba