Index: trunk/phase3/includes/LinkBatch.php |
— | — | @@ -136,23 +136,19 @@ |
137 | 137 | } |
138 | 138 | wfProfileIn( __METHOD__ ); |
139 | 139 | |
140 | | - // Construct query |
141 | | - // This is very similar to Parser::replaceLinkHolders |
| 140 | + // This is similar to LinkHolderArray::replaceInternal |
142 | 141 | $dbr = wfGetDB( DB_SLAVE ); |
143 | | - $page = $dbr->tableName( 'page' ); |
144 | | - $set = $this->constructSet( 'page', $dbr ); |
145 | | - if ( $set === false ) { |
146 | | - wfProfileOut( __METHOD__ ); |
147 | | - return false; |
148 | | - } |
149 | | - $sql = "SELECT page_id, page_namespace, page_title, page_len, page_is_redirect, page_latest FROM $page WHERE $set"; |
| 142 | + $table = 'page'; |
| 143 | + $fields = array( 'page_id', 'page_namespace', 'page_title', 'page_len', |
| 144 | + 'page_is_redirect', 'page_latest' ); |
| 145 | + $conds = $this->constructSet( 'page', $dbr ); |
150 | 146 | |
151 | 147 | // Do query |
152 | 148 | $caller = __METHOD__; |
153 | 149 | if ( strval( $this->caller ) !== '' ) { |
154 | 150 | $caller .= " (for {$this->caller})"; |
155 | 151 | } |
156 | | - $res = $dbr->query( $sql, $caller ); |
| 152 | + $res = $dbr->select( $table, $fields, $conds, $caller ); |
157 | 153 | wfProfileOut( __METHOD__ ); |
158 | 154 | return $res; |
159 | 155 | } |
— | — | @@ -165,6 +161,6 @@ |
166 | 162 | * @return mixed string with SQL where clause fragment, or false if no items. |
167 | 163 | */ |
168 | 164 | public function constructSet( $prefix, $db ) { |
169 | | - return $db->makeWhereFrom2d( $this->data, "{$prefix}_namespace", "{$prefix}_title" ); |
| 165 | + return $db->makeWhereFrom2d( $this->data, "{$prefix}_namespace", "{$prefix}_title" ); |
170 | 166 | } |
171 | 167 | } |