Index: trunk/extensions/FlaggedRevs/maintenance/reviewAllPages.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | exit(0); |
19 | 19 | } |
20 | 20 | |
21 | | -error_reporting( E_ALL & (~E_NOTICE) ); |
| 21 | +error_reporting( E_ALL ); |
22 | 22 | |
23 | 23 | $db = wfGetDB( DB_MASTER ); |
24 | 24 | $user = User::newFromId( intval($args[0]) ); |
Index: trunk/extensions/FlaggedRevs/maintenance/updateLinks.inc |
— | — | @@ -1,10 +1,12 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | | -define( 'BATCH_SIZE',500 ); |
5 | | - |
6 | 4 | function update_flaggedrevs() { |
7 | 5 | echo "Populating and correcting flaggedrevs columns\n"; |
| 6 | + |
| 7 | + $BATCH_SIZE = 500; |
| 8 | + |
8 | 9 | $db = wfGetDB( DB_MASTER ); |
| 10 | + |
9 | 11 | $start = $db->selectField( 'flaggedrevs', 'MIN(fr_rev_id)', false, __FUNCTION__ ); |
10 | 12 | $end = $db->selectField( 'flaggedrevs', 'MAX(fr_rev_id)', false, __FUNCTION__ ); |
11 | 13 | if( is_null( $start ) || is_null( $end ) ){ |
— | — | @@ -12,9 +14,9 @@ |
13 | 15 | return; |
14 | 16 | } |
15 | 17 | # Do remaining chunk |
16 | | - $end += BATCH_SIZE - 1; |
| 18 | + $end += $BATCH_SIZE - 1; |
17 | 19 | $blockStart = $start; |
18 | | - $blockEnd = $start + BATCH_SIZE - 1; |
| 20 | + $blockEnd = $start + $BATCH_SIZE - 1; |
19 | 21 | $count = 0; |
20 | 22 | $changed = 0; |
21 | 23 | while( $blockEnd <= $end ) { |
— | — | @@ -41,8 +43,8 @@ |
42 | 44 | array( 'fi_rev_id' => $row->fr_rev_id, |
43 | 45 | 'fi_name' => $row->page_title ), |
44 | 46 | __METHOD__ ); |
45 | | - $time = $row ? $row->fi_img_timestamp : null; |
46 | | - $sha1 = $row ? $row->fi_img_sha1 : null; |
| 47 | + $time = $row ? $row->fr_img_timestamp : null; |
| 48 | + $sha1 = $row ? $row->fr_img_sha1 : null; |
47 | 49 | $file = $row ? $row->page_title : null; |
48 | 50 | } |
49 | 51 | if( $file && ($file != $row->fr_img_name || $time != $row->fr_img_timestamp || $sha1 != $row->fr_img_sha1) ) { |
— | — | @@ -61,8 +63,8 @@ |
62 | 64 | $count++; |
63 | 65 | } |
64 | 66 | $db->freeResult( $res ); |
65 | | - $blockStart += BATCH_SIZE - 1; |
66 | | - $blockEnd += BATCH_SIZE - 1; |
| 67 | + $blockStart += $BATCH_SIZE - 1; |
| 68 | + $blockEnd += $BATCH_SIZE - 1; |
67 | 69 | wfWaitForSlaves( 5 ); |
68 | 70 | } |
69 | 71 | echo "fr_quality and fr_img_* columns update complete ... {$count} rows [{$changed} changed]\n"; |
— | — | @@ -70,7 +72,11 @@ |
71 | 73 | |
72 | 74 | function update_flaggedpages() { |
73 | 75 | echo "Populating and correcting flaggedpages columns\n"; |
| 76 | + |
| 77 | + $BATCH_SIZE = 500; |
| 78 | + |
74 | 79 | $db = wfGetDB( DB_MASTER ); |
| 80 | + |
75 | 81 | $start = $db->selectField( 'page', 'MIN(page_id)', false, __FUNCTION__ ); |
76 | 82 | $end = $db->selectField( 'page', 'MAX(page_id)', false, __FUNCTION__ ); |
77 | 83 | if( is_null( $start ) || is_null( $end ) ){ |
— | — | @@ -78,9 +84,9 @@ |
79 | 85 | return; |
80 | 86 | } |
81 | 87 | # Do remaining chunk |
82 | | - $end += BATCH_SIZE - 1; |
| 88 | + $end += $BATCH_SIZE - 1; |
83 | 89 | $blockStart = $start; |
84 | | - $blockEnd = $start + BATCH_SIZE - 1; |
| 90 | + $blockEnd = $start + $BATCH_SIZE - 1; |
85 | 91 | $count = 0; |
86 | 92 | $deleted = 0; |
87 | 93 | while( $blockEnd <= $end ) { |
— | — | @@ -99,15 +105,15 @@ |
100 | 106 | # Somethings broke? Delete the row... |
101 | 107 | } else { |
102 | 108 | $db->delete( 'flaggedpages', |
103 | | - array( 'fp_page_id' => $row->fp_page_id ), |
| 109 | + array( 'fp_page_id' => $row->page_id ), |
104 | 110 | __FUNCTION__ ); |
105 | 111 | if( $db->affectedRows() > 0 ) |
106 | 112 | $deleted++; |
107 | 113 | } |
108 | 114 | $count++; |
109 | 115 | } |
110 | | - $blockStart += BATCH_SIZE - 1; |
111 | | - $blockEnd += BATCH_SIZE - 1; |
| 116 | + $blockStart += $BATCH_SIZE - 1; |
| 117 | + $blockEnd += $BATCH_SIZE - 1; |
112 | 118 | wfWaitForSlaves( 5 ); |
113 | 119 | } |
114 | 120 | echo "flaggedpage columns update complete ... {$count} rows [{$deleted} deleted]\n"; |