/**
* Makes a wfStrencoded list from an array
- * $mode: LIST_COMMA - comma separated, no field names
+ * $mode:
+ * LIST_COMMA - comma separated, no field names
* LIST_AND - ANDed WHERE clause (without the WHERE)
+ * LIST_OR - ORed WHERE clause (without the WHERE)
* LIST_SET - comma separated with field names, like a SET clause
* LIST_NAMES - comma separated field names
*/
}
if ( ($mode == LIST_AND || $mode == LIST_OR) && is_numeric( $field ) ) {
$list .= "($value)";
- } elseif ( $mode == LIST_AND && is_array ($value) ) {
+ } elseif ( ($mode == LIST_AND || $mode == LIST_OR) && is_array ($value) ) {
$list .= $field." IN (".$this->makeList($value).") ";
} else {
if ( $mode == LIST_AND || $mode == LIST_OR || $mode == LIST_SET ) {
$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
$fname = 'LinkBatch::doQuery';
$namespaces = array();
- if ( !count( $this->data ) ) {
+ if ( $this->isEmpty() ) {
return false;
}
wfProfileIn( $fname );