Fix scripts not working due to uncomitted transactions.

Scripts like removeUnusedAccounts.php weren't working eventhough
their output would suggest everything is fine.

This applies the following bug fix from MediaWiki core:
 c628b6d121b49319e783dd80f7cae4284807634b

Change-Id: I485737f673573955cb56f49b831c62960e2eb5f7