Clean up after r14751:
[lhc/web/wiklou.git] / includes / LinkBatch.php
index 7586cbc..e0f0f6f 100644 (file)
@@ -47,11 +47,34 @@ class LinkBatch {
        }
 
        /**
-        * Do the query and add the results to a LinkCache object
+        * 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
+        */
+        function execute() {
+               $linkCache =& LinkCache::singleton();
+               $this->executeInto( $linkCache );
+        }
+
+       /**
+        * Do the query and add the results to a given LinkCache object
         * Return an array mapping PDBK to ID
         */
-       function execute( &$cache ) {
-               $fname = 'LinkBatch::execute';
+       function executeInto( &$cache ) {
+               $fname = 'LinkBatch::executeInto';
                wfProfileIn( $fname );
                // Do query
                $res = $this->doQuery();
@@ -88,10 +111,10 @@ class LinkBatch {
         * 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 );
@@ -102,6 +125,7 @@ class LinkBatch {
                $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";
@@ -116,9 +140,9 @@ class LinkBatch {
         * 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;