diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
commit | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch) | |
tree | 577a29fb579188d16003a209ce2a2e9c5b0aa2bd /includes/cache/LinkCache.php | |
parent | cacc939b34e315b85e2d72997811eb6677996cc1 (diff) |
Update to MediaWiki 1.21.1
Diffstat (limited to 'includes/cache/LinkCache.php')
-rw-r--r-- | includes/cache/LinkCache.php | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/includes/cache/LinkCache.php b/includes/cache/LinkCache.php index f759c020..0e41e265 100644 --- a/includes/cache/LinkCache.php +++ b/includes/cache/LinkCache.php @@ -74,11 +74,11 @@ class LinkCache { * Get a field of a title object from cache. * If this link is not good, it will return NULL. * @param $title Title - * @param $field String: ('length','redirect','revision') + * @param string $field ('length','redirect','revision','model') * @return mixed */ public function getGoodLinkFieldObj( $title, $field ) { - $dbkey = $title->getPrefixedDbKey(); + $dbkey = $title->getPrefixedDBkey(); if ( array_key_exists( $dbkey, $this->mGoodLinkFields ) ) { return $this->mGoodLinkFields[$dbkey][$field]; } else { @@ -102,14 +102,16 @@ class LinkCache { * @param $len Integer: text's length * @param $redir Integer: whether the page is a redirect * @param $revision Integer: latest revision's ID + * @param $model Integer: latest revision's content model ID */ - public function addGoodLinkObj( $id, $title, $len = -1, $redir = null, $revision = false ) { - $dbkey = $title->getPrefixedDbKey(); + public function addGoodLinkObj( $id, $title, $len = -1, $redir = null, $revision = false, $model = false ) { + $dbkey = $title->getPrefixedDBkey(); $this->mGoodLinks[$dbkey] = intval( $id ); $this->mGoodLinkFields[$dbkey] = array( 'length' => intval( $len ), 'redirect' => intval( $redir ), - 'revision' => intval( $revision ) ); + 'revision' => intval( $revision ), + 'model' => intval( $model ) ); } /** @@ -117,15 +119,16 @@ class LinkCache { * @since 1.19 * @param $title Title * @param $row object which has the fields page_id, page_is_redirect, - * page_latest + * page_latest and page_content_model */ public function addGoodLinkObjFromRow( $title, $row ) { - $dbkey = $title->getPrefixedDbKey(); + $dbkey = $title->getPrefixedDBkey(); $this->mGoodLinks[$dbkey] = intval( $row->page_id ); $this->mGoodLinkFields[$dbkey] = array( 'length' => intval( $row->page_len ), 'redirect' => intval( $row->page_is_redirect ), 'revision' => intval( $row->page_latest ), + 'model' => !empty( $row->page_content_model ) ? strval( $row->page_content_model ) : null, ); } @@ -133,7 +136,7 @@ class LinkCache { * @param $title Title */ public function addBadLinkObj( $title ) { - $dbkey = $title->getPrefixedDbKey(); + $dbkey = $title->getPrefixedDBkey(); if ( !$this->isBadLink( $dbkey ) ) { $this->mBadLinks[$dbkey] = 1; } @@ -147,7 +150,7 @@ class LinkCache { * @param $title Title */ public function clearLink( $title ) { - $dbkey = $title->getPrefixedDbKey(); + $dbkey = $title->getPrefixedDBkey(); unset( $this->mBadLinks[$dbkey] ); unset( $this->mGoodLinks[$dbkey] ); unset( $this->mGoodLinkFields[$dbkey] ); @@ -159,7 +162,7 @@ class LinkCache { /** * Add a title to the link cache, return the page_id or zero if non-existent * - * @param $title String: title to add + * @param string $title title to add * @return Integer */ public function addLink( $title ) { @@ -178,7 +181,8 @@ class LinkCache { * @return Integer */ public function addLinkObj( $nt ) { - global $wgAntiLockFlags; + global $wgAntiLockFlags, $wgContentHandlerUseDB; + wfProfileIn( __METHOD__ ); $key = $nt->getPrefixedDBkey(); @@ -210,8 +214,10 @@ class LinkCache { $options = array(); } - $s = $db->selectRow( 'page', - array( 'page_id', 'page_len', 'page_is_redirect', 'page_latest' ), + $f = array( 'page_id', 'page_len', 'page_is_redirect', 'page_latest' ); + if ( $wgContentHandlerUseDB ) $f[] = 'page_content_model'; + + $s = $db->selectRow( 'page', $f, array( 'page_namespace' => $nt->getNamespace(), 'page_title' => $nt->getDBkey() ), __METHOD__, $options ); # Set fields... |