Add checks to try to catch T92046
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 31 Mar 2015 17:28:45 +0000 (13:28 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Tue, 31 Mar 2015 17:33:50 +0000 (13:33 -0400)
commit58dba7d8b2a3c75b9f369dcb2def81a8d061a72d
tree274c87795ba344a3395367893aed7181fa765c86
parent3897868db104b88f70569a22613829031fa64f5c
Add checks to try to catch T92046

Somehow, revisions are getting added to the database without issue but
page_latest is being set to 0 rather than the newly-added revision ID.
Grepping through the code, the only places page_latest gets set are
WikiPage::insertOn() (which isn't relevant for an edit of an existing
page) and WikiPage::updateRevisionOn(). And the only relevant-looking
place WikiPage::updateRevisionOn() gets called seems to be
WikiPage::doEditContent(), which calls Revision::insertOn() just before
which *should* be setting the mId on the revision object.

Since there's no obvious bug in the code, let's add some checks to make
sure that the revision ID isn't 0. If we see exceptions being thrown, at
least we'll have narrowed down the places we need to look more deeply.
And if not (and the bug continues to be reported), we'll at least know
this part is working right.

Bug: T92046
Change-Id: I8cc60593fafb5702e29186ec14cb9d87f1767ef4
includes/Revision.php
includes/page/WikiPage.php