Don't require an existence check before calling loadPageData(). Added an accessor...
[lhc/web/wiklou.git] / includes / LinkBatch.php
index 7586cbc..43282ab 100644 (file)
@@ -47,11 +47,20 @@ class LinkBatch {
        }
 
        /**
-        * Do the query and add the results to a LinkCache object
+        * Do the query and add the results to the LinkCache object
         * Return an array mapping PDBK to ID
         */
-       function execute( &$cache ) {
-               $fname = 'LinkBatch::execute';
+        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 executeInto( &$cache ) {
+               $fname = 'LinkBatch::executeInto';
                wfProfileIn( $fname );
                // Do query
                $res = $this->doQuery();
@@ -88,7 +97,7 @@ 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 ) ) {
@@ -102,6 +111,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";