diff options
Diffstat (limited to 'includes/cache/LinkBatch.php')
-rw-r--r-- | includes/cache/LinkBatch.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/includes/cache/LinkBatch.php b/includes/cache/LinkBatch.php index 0bd869fc..17e8739b 100644 --- a/includes/cache/LinkBatch.php +++ b/includes/cache/LinkBatch.php @@ -86,7 +86,8 @@ class LinkBatch { /** * Do the query and add the results to the LinkCache object - * Return an array mapping PDBK to ID + * + * @return Array mapping PDBK to ID */ public function execute() { $linkCache = LinkCache::singleton(); @@ -96,12 +97,15 @@ class LinkBatch { /** * Do the query and add the results to a given LinkCache object * Return an array mapping PDBK to ID + * + * @param $cache LinkCache + * @return Array remaining IDs */ protected function executeInto( &$cache ) { wfProfileIn( __METHOD__ ); $res = $this->doQuery(); - $ids = $this->addResultToCache( $cache, $res ); $this->doGenderQuery(); + $ids = $this->addResultToCache( $cache, $res ); wfProfileOut( __METHOD__ ); return $ids; } @@ -112,8 +116,9 @@ class LinkBatch { * This function *also* stores extra fields of the title used for link * parsing to avoid extra DB queries. * - * @param $cache + * @param $cache LinkCache * @param $res + * @return Array of remaining titles */ public function addResultToCache( $cache, $res ) { if ( !$res ) { @@ -126,7 +131,7 @@ class LinkBatch { $remaining = $this->data; foreach ( $res as $row ) { $title = Title::makeTitle( $row->page_namespace, $row->page_title ); - $cache->addGoodLinkObj( $row->page_id, $title, $row->page_len, $row->page_is_redirect, $row->page_latest ); + $cache->addGoodLinkObjFromRow( $title, $row ); $ids[$title->getPrefixedDBkey()] = $row->page_id; unset( $remaining[$row->page_namespace][$row->page_title] ); } @@ -144,6 +149,7 @@ class LinkBatch { /** * Perform the existence test query, return a ResultWrapper with page_id fields + * @return Bool|ResultWrapper */ public function doQuery() { if ( $this->isEmpty() ) { @@ -168,6 +174,11 @@ class LinkBatch { return $res; } + /** + * Do (and cache) {{GENDER:...}} information for userpages in this LinkBatch + * + * @return bool whether the query was successful + */ public function doGenderQuery() { if ( $this->isEmpty() ) { return false; @@ -180,6 +191,7 @@ class LinkBatch { $genderCache = GenderCache::singleton(); $genderCache->dolinkBatch( $this->data, $this->caller ); + return true; } /** |