Index: trunk/extensions/FlaggedRevs/maintenance/populateRevTimestamp.php |
— | — | @@ -19,7 +19,7 @@ |
20 | 20 | php populateRevTimestamp.php [--startrev <ID>] |
21 | 21 | |
22 | 22 | --help : This help message |
23 | | - --<ID> : The ID of the starting rev |
| 23 | + --<ID> : The ID of the starting rev or 'prev' (from last run) |
24 | 24 | |
25 | 25 | TEXT; |
26 | 26 | exit(0); |
— | — | @@ -27,7 +27,13 @@ |
28 | 28 | |
29 | 29 | error_reporting( E_ALL ); |
30 | 30 | |
31 | | -$startRev = isset( $options['startrev'] ) ? |
32 | | - (int)$options['startrev'] : null; |
| 31 | +$startRev = null; |
| 32 | +if ( isset( $options['startrev'] ) ) { |
| 33 | + if ( $options['startrev'] === 'prev' ) { |
| 34 | + $startRev = (int)file_get_contents( last_pos_file() ); |
| 35 | + } else { |
| 36 | + $startRev = (int)$options['startrev']; |
| 37 | + } |
| 38 | +} |
33 | 39 | |
34 | 40 | populate_fr_rev_timestamp( $startRev ); |
Index: trunk/extensions/FlaggedRevs/maintenance/populateRevTimestamp.inc |
— | — | @@ -1,12 +1,12 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | function populate_fr_rev_timestamp( $start = null ) { |
5 | | - echo "Populating and correcting flaggedrevs columns\n"; |
6 | | - |
| 5 | + echo "Populating and correcting flaggedrevs columns from $start\n"; |
| 6 | + |
7 | 7 | $BATCH_SIZE = 1000; |
8 | | - |
| 8 | + |
9 | 9 | $db = wfGetDB( DB_MASTER ); |
10 | | - |
| 10 | + |
11 | 11 | if ( $start === null ) { |
12 | 12 | $start = $db->selectField( 'flaggedrevs', 'MIN(fr_rev_id)', false, __FUNCTION__ ); |
13 | 13 | } |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | $cond = "fr_rev_id BETWEEN $blockStart AND $blockEnd AND fr_rev_timestamp = ''"; |
28 | 28 | $res = $db->select( |
29 | 29 | array( 'flaggedrevs', 'revision', 'archive' ), |
30 | | - array( 'fr_rev_id', 'rev_timestamp', 'ar_timestamp' ), |
| 30 | + array( 'fr_rev_id', 'rev_timestamp', 'ar_timestamp' ), |
31 | 31 | $cond, |
32 | 32 | __FUNCTION__, |
33 | 33 | array(), |
— | — | @@ -59,5 +59,10 @@ |
60 | 60 | $blockEnd += $BATCH_SIZE; |
61 | 61 | wfWaitForSlaves( 5 ); |
62 | 62 | } |
| 63 | + file_put_contents( last_pos_file(), $end ); |
63 | 64 | echo "fr_rev_timestamp columns update complete ... {$count} rows [{$changed} changed]\n"; |
64 | 65 | } |
| 66 | + |
| 67 | +function last_pos_file() { |
| 68 | + return dirname( __FILE__ ) . "/popRevTimestampLast-" . wfWikiID(); |
| 69 | +} |