Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -282,83 +282,8 @@ |
283 | 283 | // Return count of revisions |
284 | 284 | return $db->numRows($result); |
285 | 285 | } |
286 | | - |
287 | | - /** |
288 | | - * Get all the revisions that meet the requirments |
289 | | - * per the $wgFlaggedRevTags variable |
290 | | - * This can become expensive |
291 | | - * @param database $db |
292 | | - * @param int $page_id |
293 | | - * @param int $limit |
294 | | - * @param int $max_rev_id the revision ids should be less than this |
295 | | - */ |
296 | | - function getQualityRevisions( $db, $page_id, $limit=1, $max_rev_id=NULL ) { |
297 | | - global $wgFlaggedRevTags; |
298 | 286 | |
299 | | - wfProfileIn( __METHOD__ ); |
300 | | - |
301 | | - $tagwhere = array(); |
302 | | - // Look for $wgFlaggedRevTags key flags only |
303 | | - foreach ( $wgFlaggedRevTags as $flag => $min) { |
304 | | - $tagwhere[] = '(frt_dimension = ' . $db->addQuotes($flag) . ' AND frt_value >= ' . intval($min) . ')'; |
305 | | - } |
306 | | - $tagwhere = implode(' OR ', $tagwhere); |
307 | | - $maxrevid = $max_rev_id ? "frt_rev_id < $max_rev_id" : '1 = 1'; |
308 | | - // Skip archived/deleted revs |
309 | | - // Get group rows of the newest flagged revs and the number |
310 | | - // of key flags that were fulfilled |
311 | | - $result = $db->select( |
312 | | - array('flaggedrevtags','flaggedrevs','revision'), |
313 | | - array('fr_rev_id', 'fr_user', 'fr_timestamp', 'fr_comment', 'rev_timestamp', 'COUNT(*)'), |
314 | | - array('frt_page_id' => $page_id, $tagwhere, $maxrevid, 'frt_rev_id=fr_rev_id', 'fr_rev_id=rev_id', 'rev_deleted=0'), |
315 | | - __METHOD__, |
316 | | - array('GROUP BY' => 'frt_rev_id', 'HAVING' => 'COUNT(*)='.$wgFlaggedRevTags, 'ORDER BY' => 'frt_rev_id DESC', 'LIMIT' => $limit) ); |
317 | | - // Iterate through each flagged revision row |
318 | | - $out = array(); |
319 | | - while ( $row = $db->fetchObject($result) ) { |
320 | | - $out[] = $row; |
321 | | - } |
322 | | - return $out; |
323 | | - } |
324 | | - |
325 | 287 | /** |
326 | | - * Get all the revisions that meet the requirments |
327 | | - * per the $wgFlaggedRevTags variable |
328 | | - * This can become expensive, use it if you changed |
329 | | - * your quality criteria |
330 | | - * @param database $db |
331 | | - * @param int $page_id |
332 | | - * @param int $limit |
333 | | - * @param int $max_rev_id the revision ids should be less than this |
334 | | - */ |
335 | | - function getStableRevisions( $db, $page_id, $limit=1, $max_rev_id=NULL ) { |
336 | | - global $wgFlaggedRevTags; |
337 | | - |
338 | | - wfProfileIn( __METHOD__ ); |
339 | | - |
340 | | - $maxrevid = $max_rev_id ? "fr_rev_id < $max_rev_id" : '1 = 1'; |
341 | | - // Skip archived/deleted revs |
342 | | - // Get group rows of the newest flagged revs and the number |
343 | | - // of key flags that were fulfilled |
344 | | - $result = $db->select( |
345 | | - array('flaggedrevs','revision'), |
346 | | - array('fr_rev_id', 'fr_user', 'fr_timestamp', 'fr_comment', 'rev_timestamp'), |
347 | | - array('fr_page_id' => $page_id, $maxrevid, 'fr_rev_id=rev_id', 'rev_deleted=0'), |
348 | | - __METHOD__, |
349 | | - array('ORDER BY' => 'fr_rev_id DESC') ); |
350 | | - // Iterate through each flagged revision row |
351 | | - $out = array(); |
352 | | - $counter = 0; |
353 | | - while ( $row = $db->fetchObject($result) ) { |
354 | | - // Only return so many results |
355 | | - if ( $counter > $limit ) break; |
356 | | - $out[] = $row; |
357 | | - $counter++; |
358 | | - } |
359 | | - return $out; |
360 | | - } |
361 | | - |
362 | | - /** |
363 | 288 | * @param int $rev_id |
364 | 289 | * Return an array output of the flags for a given revision |
365 | 290 | */ |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.sql |
— | — | @@ -16,11 +16,11 @@ |
17 | 17 | -- Store the text with all transclusions resolved |
18 | 18 | -- This will trade space for more speed and reliability |
19 | 19 | fr_text mediumblob NOT NULL default '', |
| 20 | + -- Store the precedence level |
20 | 21 | fr_quality tinyint(1) default 0, |
21 | | - |
22 | | - PRIMARY KEY fr_rev_id (fr_rev_id), |
23 | | - UNIQUE KEY (fr_id), |
24 | | - INDEX fr_page_rev (fr_page_id,fr_rev_id) |
| 22 | + |
| 23 | + PRIMARY KEY (fr_page_id,fr_rev_id), |
| 24 | + UNIQUE KEY (fr_id) |
25 | 25 | ) TYPE=InnoDB; |
26 | 26 | |
27 | 27 | -- This stores all of our tag data |
— | — | @@ -31,8 +31,8 @@ |
32 | 32 | frt_dimension varchar(255) NOT NULL, |
33 | 33 | frt_value tinyint(2) NOT NULL, |
34 | 34 | |
35 | | - PRIMARY KEY frt_rev_dimension (frt_rev_id,frt_dimension), |
36 | | - INDEX frt_page_rev_val (frt_page_id,frt_rev_id,frt_dimension,frt_value) |
| 35 | + PRIMARY KEY (frt_rev_id,frt_dimension), |
| 36 | + INDEX frt_rev_dim_val (frt_rev_id,frt_dimension,frt_value) |
37 | 37 | ) TYPE=InnoDB; |
38 | 38 | |
39 | 39 | -- For future restrictons |