<?php
+/**
+ * Batch query to determine page existence.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ * @ingroup Cache
+ */
/**
* Class representing a list of titles
}
}
+ /**
+ * @param $ns int
+ * @param $dbkey string
+ * @return mixed
+ */
public function add( $ns, $dbkey ) {
if ( $ns < 0 ) {
return;
/**
* 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();
/**
* 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;
}
* 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 ) {
$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] );
}
/**
* Perform the existence test query, return a ResultWrapper with page_id fields
+ * @return Bool|ResultWrapper
*/
public function doQuery() {
if ( $this->isEmpty() ) {
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;
}
$genderCache = GenderCache::singleton();
- $genderCache->dolinkBatch( $this->data, $this->caller );
+ $genderCache->doLinkBatch( $this->data, $this->caller );
+ return true;
}
/**