Index: trunk/extensions/PageTriage/includes/ArticleMetadata.php |
— | — | @@ -233,72 +233,6 @@ |
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
237 | | - * Get a list of untriaged articles based on the search criteria |
238 | | - * @param $criteria array - list of tags for the filter |
239 | | - * @param $offset string |
240 | | - * @param $backwards bool - flag to check whether to get data backward |
241 | | - * |
242 | | - * @Todo - Pass a range for timestamp to avoid full index scan |
243 | | - */ |
244 | | - public static function getUnTriagedArticleByMetadata( $criteria = array(), $offset = '', $backwards = false ) { |
245 | | - global $wgPageTriagePageIdPerRequest; |
246 | | - |
247 | | - $tags = self::getValidTags(); |
248 | | - |
249 | | - if ( count( $criteria ) > count( $tags ) ) { |
250 | | - throw new MWArticleMetadataMetaDataOutofBoundException( 'Invalid search criteria are provided' ); |
251 | | - } |
252 | | - |
253 | | - $dbr = wfGetDB( DB_SLAVE ); |
254 | | - |
255 | | - $table = array( 'pagetriage_page', 'page' ); |
256 | | - |
257 | | - $tagConds = ''; |
258 | | - $tagCount = 0; |
259 | | - // Check for valid tags and construct tag query |
260 | | - foreach ( $criteria as $key => $val ) { |
261 | | - if ( isset( $tags[$key] ) ) { |
262 | | - if ( $tagConds ) { |
263 | | - $tagConds .= ' OR '; |
264 | | - } |
265 | | - $tagConds .= " ( ptrpt_tag_id = " . $tags[$key] . " AND ptrpt_value = " . $dbr->addQuotes( $val ) . " ) "; |
266 | | - $tagCount++; |
267 | | - } |
268 | | - } |
269 | | - |
270 | | - $conds = array( 'ptrp_page_id = page_id', 'ptrp_triaged' => '0' ); |
271 | | - |
272 | | - if ( $offset ) { |
273 | | - $arr = explode( '|', $offset, 2 ); |
274 | | - $ts = $dbr->addQuotes( $dbr->timestamp( $arr[0] ) ); |
275 | | - $id = isset( $arr[1] ) ? intval( $arr[1] ) : 0; |
276 | | - $op = $backwards ? '<' : '>'; |
277 | | - $conds[] = "ptrp_timestamp $op $ts OR (ptrp_timestamp = $ts AND ptrp_id $op= $id)"; |
278 | | - } |
279 | | - |
280 | | - $desc = $backwards ? 'DESC' : ''; |
281 | | - $opts = array( 'LIMIT' => $wgPageTriagePageIdPerRequest + 1, "ORDER BY ptrp_timestamp $desc ptrp_id $desc" ); |
282 | | - |
283 | | - if ( $tagCount ) { |
284 | | - $conds[] = '(' . $tagConds . ')'; |
285 | | - $conds[] = 'ptrpt_page_id = ptrp_page_id'; |
286 | | - $opts['GROUP BY'] = 'ptrpt_page_id'; |
287 | | - $opts['HAVING'] = 'COUNT(ptrpt_tag_id) = ' . $tagCount; |
288 | | - $table[] = 'pagetriage_page_tags'; |
289 | | - } |
290 | | - |
291 | | - $res = $dbr->select( |
292 | | - $table, |
293 | | - array( 'ptrp_page_id' ), |
294 | | - $conds, |
295 | | - __METHOD__, |
296 | | - $opts |
297 | | - ); |
298 | | - |
299 | | - return iterator_to_array( $res ); |
300 | | - } |
301 | | - |
302 | | - /** |
303 | 237 | * Compile article basic data like title, number of bytes |
304 | 238 | * @param $metaData array |
305 | 239 | */ |