EBernhardson has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/187158

Change subject: Title: Always add title to LinkCache when necessary (in 3 
methods)
......................................................................

Title: Always add title to LinkCache when necessary (in 3 methods)

Unless Title::GAID_FOR_UPDATE is specified, Title::getArticleID() will not
use the link cache if the Title already has the ID of the page. Account for
this by directly calling LinkCache::addLinkObj() in three other methods of
Title: getContentModel(), isRedirect(), and getLength().

Follows-up r33008 (aed9d4b91218) and dd5c1b7fb7ff, and reapplies part of
388b14a15de6.

Bug: T86974
Change-Id: I7eff0bffd4f632ceb8d2124af317d684dbcaf2cb
(cherry picked from commit 50c9bbfbd50e726bf8fe5f5629582e7f71f97dba)
---
M RELEASE-NOTES-1.25
M includes/Title.php
2 files changed, 9 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/58/187158/1

diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index a217b4e..f13042c 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -124,6 +124,11 @@
   on action=info about a file page does not list file links anymore.
 * (T78637) Search bar is not autofocused unless it is empty so that proper 
scrolling using arrow keys is possible.
 * (T50853) Database::makeList() modified to handle 'NULL' separately when 
building IN clause
+* (T85192) Captcha position modified in Usercreate template. As a result:
+** extrafields parameter added to Usercreate.php to insert additional data
+** 'extend' method added to QuickTemplate to append additional values to any 
field of data array
+* (T86974) Several Title methods now load from the database when necessary
+  (instead of returning incorrect results) even when the page ID is known.
 
 === Action API changes in 1.25 ===
 * (T67403) XML tag highlighting is now only performed for formats
diff --git a/includes/Title.php b/includes/Title.php
index 24f4331..bcd94df 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -942,9 +942,9 @@
         * @return string Content model id
         */
        public function getContentModel( $flags = 0 ) {
-               # Calling getArticleID() loads the field from cache as needed
                if ( !$this->mContentModel && $this->getArticleID( $flags ) ) {
                        $linkCache = LinkCache::singleton();
+                       $linkCache->addLinkObj( $this ); # in case we already 
had an article ID
                        $this->mContentModel = $linkCache->getGoodLinkFieldObj( 
$this, 'model' );
                }
 
@@ -3192,13 +3192,13 @@
                if ( !is_null( $this->mRedirect ) ) {
                        return $this->mRedirect;
                }
-               # Calling getArticleID() loads the field from cache as needed
                if ( !$this->getArticleID( $flags ) ) {
                        $this->mRedirect = false;
                        return $this->mRedirect;
                }
 
                $linkCache = LinkCache::singleton();
+               $linkCache->addLinkObj( $this ); # in case we already had an 
article ID
                $cached = $linkCache->getGoodLinkFieldObj( $this, 'redirect' );
                if ( $cached === null ) {
                        # Trust LinkCache's state over our own
@@ -3227,12 +3227,12 @@
                if ( $this->mLength != -1 ) {
                        return $this->mLength;
                }
-               # Calling getArticleID() loads the field from cache as needed
                if ( !$this->getArticleID( $flags ) ) {
                        $this->mLength = 0;
                        return $this->mLength;
                }
                $linkCache = LinkCache::singleton();
+               $linkCache->addLinkObj( $this ); # in case we already had an 
article ID
                $cached = $linkCache->getGoodLinkFieldObj( $this, 'length' );
                if ( $cached === null ) {
                        # Trust LinkCache's state over our own, as for 
isRedirect()
@@ -3255,13 +3255,12 @@
                if ( !( $flags & Title::GAID_FOR_UPDATE ) && $this->mLatestID 
!== false ) {
                        return intval( $this->mLatestID );
                }
-               # Calling getArticleID() loads the field from cache as needed
                if ( !$this->getArticleID( $flags ) ) {
                        $this->mLatestID = 0;
                        return $this->mLatestID;
                }
                $linkCache = LinkCache::singleton();
-               $linkCache->addLinkObj( $this );
+               $linkCache->addLinkObj( $this ); # in case we already had an 
article ID
                $cached = $linkCache->getGoodLinkFieldObj( $this, 'revision' );
                if ( $cached === null ) {
                        # Trust LinkCache's state over our own, as for 
isRedirect()

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I7eff0bffd4f632ceb8d2124af317d684dbcaf2cb
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.25wmf14
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: PleaseStand <[email protected]>

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

Reply via email to