Daniel Kinzler has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/387063 )

Change subject: Warn when page_latest is 0 unexpectedly.
......................................................................

Warn when page_latest is 0 unexpectedly.

Change-Id: I5aec379f2df0d39aad7c90a7ae2ea69abb7b4210
---
M includes/Title.php
M includes/cache/LinkCache.php
2 files changed, 11 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/63/387063/1

diff --git a/includes/Title.php b/includes/Title.php
index 718239d..22b98b3 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -481,6 +481,10 @@
                        }
                        if ( isset( $row->page_latest ) ) {
                                $this->mLatestID = (int)$row->page_latest;
+                               if ( !$this->mLatestID ) {
+                                       wfWarn( 'Initializing Title from page 
row with page_latest = 0!' );
+                                       $this->mLatestID = false;
+                               }
                        }
                        if ( !$this->mForcedContentModel && isset( 
$row->page_content_model ) ) {
                                $this->mContentModel = strval( 
$row->page_content_model );
@@ -3431,6 +3435,7 @@
                $cached = $linkCache->getGoodLinkFieldObj( $this, 'revision' );
                if ( $cached === null ) {
                        # Trust LinkCache's state over our own, as for 
isRedirect()
+                       // XXX: Shouldn't we set $this->mArticleID = 0 here? Or 
call resetArticleID()?
                        $this->mLatestID = 0;
                        return $this->mLatestID;
                }
diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php
index 2d08895..1a87c01 100644
--- a/includes/cache/LinkCache.php
+++ b/includes/cache/LinkCache.php
@@ -271,8 +271,12 @@
                }
 
                if ( $row ) {
-                       $this->addGoodLinkObjFromRow( $nt, $row );
-                       $id = intval( $row->page_id );
+                       if ( intval( $row->page_latest ) ) {
+                               $this->addGoodLinkObjFromRow( $nt, $row );
+                               $id = intval( $row->page_id );
+                       } else {
+                               wfWarn( 'Attempt to cache incomplete page row 
for page ID ' . $row->page_id . '!' );
+                       }
                } else {
                        $this->addBadLinkObj( $nt );
                        $id = 0;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5aec379f2df0d39aad7c90a7ae2ea69abb7b4210
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to