r93036 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93035‎ | r93036 | r93037 >
Date:02:58, 25 July 2011
Author:aaron
Status:ok
Tags:
Comment:
Added simple position tracking to populateRevTimestamp.php script
Modified paths:
  • /trunk/extensions/FlaggedRevs/maintenance/populateRevTimestamp.inc (modified) (history)
  • /trunk/extensions/FlaggedRevs/maintenance/populateRevTimestamp.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/maintenance/populateRevTimestamp.php
@@ -19,7 +19,7 @@
2020 php populateRevTimestamp.php [--startrev <ID>]
2121
2222 --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)
2424
2525 TEXT;
2626 exit(0);
@@ -27,7 +27,13 @@
2828
2929 error_reporting( E_ALL );
3030
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+}
3339
3440 populate_fr_rev_timestamp( $startRev );
Index: trunk/extensions/FlaggedRevs/maintenance/populateRevTimestamp.inc
@@ -1,12 +1,12 @@
22 <?php
33
44 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+
77 $BATCH_SIZE = 1000;
8 -
 8+
99 $db = wfGetDB( DB_MASTER );
10 -
 10+
1111 if ( $start === null ) {
1212 $start = $db->selectField( 'flaggedrevs', 'MIN(fr_rev_id)', false, __FUNCTION__ );
1313 }
@@ -26,7 +26,7 @@
2727 $cond = "fr_rev_id BETWEEN $blockStart AND $blockEnd AND fr_rev_timestamp = ''";
2828 $res = $db->select(
2929 array( 'flaggedrevs', 'revision', 'archive' ),
30 - array( 'fr_rev_id', 'rev_timestamp', 'ar_timestamp' ),
 30+ array( 'fr_rev_id', 'rev_timestamp', 'ar_timestamp' ),
3131 $cond,
3232 __FUNCTION__,
3333 array(),
@@ -59,5 +59,10 @@
6060 $blockEnd += $BATCH_SIZE;
6161 wfWaitForSlaves( 5 );
6262 }
 63+ file_put_contents( last_pos_file(), $end );
6364 echo "fr_rev_timestamp columns update complete ... {$count} rows [{$changed} changed]\n";
6465 }
 66+
 67+function last_pos_file() {
 68+ return dirname( __FILE__ ) . "/popRevTimestampLast-" . wfWikiID();
 69+}

Follow-up revisions

RevisionCommit summaryAuthorDate
r95628MFT to REL1_18 (extensions)...hashar15:32, 28 August 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86179Overdue changes to `flaggedrevs` table:...aaron03:39, 16 April 2011

Status & tagging log