$this->data = $array;
}
+ /**
+ * Returns true if no pages have been added, false otherwise.
+ */
+ function isEmpty() {
+ return ($this->getSize() == 0);
+ }
+
+ /**
+ * Returns the size of the batch.
+ */
+ function getSize() {
+ return count( $this->data );
+ }
+
/**
* Do the query and add the results to the LinkCache object
* Return an array mapping PDBK to ID
* Return an array mapping PDBK to ID
*/
function executeInto( &$cache ) {
- $fname = 'LinkBatch::execute';
+ $fname = 'LinkBatch::executeInto';
wfProfileIn( $fname );
// Do query
$res = $this->doQuery();
* Perform the existence test query, return a ResultWrapper with page_id fields
*/
function doQuery() {
- $fname = 'LinkBatch::execute';
+ $fname = 'LinkBatch::doQuery';
$namespaces = array();
- if ( !count( $this->data ) ) {
+ if ( $this->isEmpty() ) {
return false;
}
wfProfileIn( $fname );
$page = $dbr->tableName( 'page' );
$set = $this->constructSet( 'page', $dbr );
if ( $set === false ) {
+ wfProfileOut( $fname );
return false;
}
$sql = "SELECT page_id, page_namespace, page_title FROM $page WHERE $set";
* Construct a WHERE clause which will match all the given titles.
* Give the appropriate table's field name prefix ('page', 'pl', etc).
*
- * @param string $prefix
+ * @param $prefix String: ??
* @return string
- * @access public
+ * @public
*/
function constructSet( $prefix, &$db ) {
$first = true;