Fix transaction nesting caused by LocalFile.
authordaniel <daniel.kinzler@wikimedia.de>
Mon, 27 Aug 2012 12:46:23 +0000 (14:46 +0200)
committerAaron <aschulz@wikimedia.org>
Fri, 7 Sep 2012 21:33:35 +0000 (14:33 -0700)
commit8322771ec3cadaee965aa2d4cdb06ad274d4d9bd
tree9515e2e94ed334fc817a3cc114c927a0f2384568
parentb2602ef651bb28132e097eebd004479f8cfa860e
Fix transaction nesting caused by LocalFile.

The transaction bracket in LocalFile::recordUpload2 used to span a call
to WikiPage::doEdit, which in turn opens a transaction. Nesting transactions
this way does not work: the first transaction is committed prematurely when
the second one starts. This may cause serious database corruption and
generally exciting behavior.

This change commits LocalFile's own transaction before any interaction
with WikiPage. There may be a race condition here, but that case seems to
be already handled in the code. Also, in the previous "broken" state, all
transactional protection got lost anyway - so this should at least be no
worse than what we had.

This may be changed back if and when we have support for nested
transactions.

Change-Id: I20d90fedb2d19c64ccf0f3942ddda756fe511c12
includes/filerepo/file/LocalFile.php