Index: branches/wmf/1.18wmf1/extensions/FlaggedRevs/maintenance/fixBug28348.inc |
— | — | @@ -19,12 +19,20 @@ |
20 | 20 | $end += $BATCH_SIZE - 1; |
21 | 21 | $blockStart = $start; |
22 | 22 | $blockEnd = $start + $BATCH_SIZE - 1; |
23 | | - |
| 23 | + |
| 24 | + $logDump = ''; |
| 25 | + |
24 | 26 | $count = $changed = 0; |
25 | 27 | while( $blockEnd <= $end ) { |
26 | 28 | echo "...doing fi_rev_id from $blockStart to $blockEnd\n"; |
27 | | - $cond = "fi_rev_id BETWEEN $blockStart AND $blockEnd"; |
28 | | - $res = $db->select( 'flaggedimages', '*', $cond, __FUNCTION__ ); |
| 29 | + $cond = "fi_rev_id BETWEEN $blockStart AND $blockEnd" . |
| 30 | + " AND fi_img_timestamp IS NOT NULL AND img_name IS NULL"; // optimize |
| 31 | + $res = $db->select( array( 'flaggedimages', 'image' ), '*', $cond, |
| 32 | + __FUNCTION__, |
| 33 | + array(), |
| 34 | + array( 'image' => array( 'LEFT JOIN', |
| 35 | + 'img_sha1 = fi_img_sha1 AND img_timestamp = fi_img_timestamp' ) ) |
| 36 | + ); |
29 | 37 | |
30 | 38 | $db->begin(); |
31 | 39 | # Go through and clean up missing items, as well as correct fr_quality... |
— | — | @@ -51,14 +59,19 @@ |
52 | 60 | __METHOD__ |
53 | 61 | ); |
54 | 62 | $changed++; |
| 63 | + $logDump .= "{$row->fi_rev_id} {$row->fi_name} {$fi_img_timestamp}\n"; |
55 | 64 | } |
56 | 65 | } |
57 | 66 | } |
58 | 67 | $db->commit(); |
| 68 | + |
59 | 69 | $db->freeResult( $res ); |
60 | 70 | $blockStart += $BATCH_SIZE; |
61 | 71 | $blockEnd += $BATCH_SIZE; |
62 | 72 | wfWaitForSlaves( 5 ); |
63 | 73 | } |
| 74 | + |
| 75 | + file_put_contents( "bug28348-fixed-" . wfWikiID(), $logDump ); |
| 76 | + |
64 | 77 | echo "fi_img_timestamp column fixes complete ... {$count} rows [{$changed} changed]\n"; |
65 | 78 | } |