jenkins-bot has submitted this change and it was merged.

Change subject: Fix fatal error when revision data isn't loaded properly
......................................................................


Fix fatal error when revision data isn't loaded properly

When pages are being created, this hook gets run before all of
the revision data has made it to the slaves. So fall back to the
master if we can't load the revision data.

Bug: 52907
Change-Id: I65420d0e4339fa8d40fd054b82ae7b57e2afd350
---
M CirrusSearch.body.php
1 file changed, 7 insertions(+), 0 deletions(-)

Approvals:
  Demon: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/CirrusSearch.body.php b/CirrusSearch.body.php
index 2673975..c4dfdca 100644
--- a/CirrusSearch.body.php
+++ b/CirrusSearch.body.php
@@ -397,6 +397,13 @@
                $title = $linkUpdate->getTitle();
                $articleId = $title->getArticleID();
                $revision = Revision::loadFromPageId( wfGetDB( DB_SLAVE ), 
$articleId );
+
+               // This usually happens on page creation when all the revision 
data hasn't
+               // replicated out to the slaves
+               if ( !$revision ) {
+                       Revision::loadFromPageId( wfGetDB( DB_MASTER ), 
$articleId );
+               }
+
                $update = new SearchUpdate( $articleId, $title, 
$revision->getContent() );
                $update->doUpdate();
        }

-- 
To view, visit https://gerrit.wikimedia.org/r/79346
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I65420d0e4339fa8d40fd054b82ae7b57e2afd350
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Demon <[email protected]>
Gerrit-Reviewer: Demon <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to