* Makes the required database updates for rev_parent_id
* to be of any use. It can be used for some simple tracking
* and to find new page edits by users.
* Makes the required database updates for rev_parent_id
* to be of any use. It can be used for some simple tracking
* and to find new page edits by users.
- public function execute() {
+ protected function getUpdateKey() {
+ return 'populate rev_parent_id';
+ }
+
+ protected function updateSkippedMessage() {
+ return 'rev_parent_id column of revision table already populated.';
+ }
+
+ protected function doDBUpdates() {
}
$this->output( "Populating rev_parent_id column\n" );
$start = $db->selectField( 'revision', 'MIN(rev_id)', false, __FUNCTION__ );
$end = $db->selectField( 'revision', 'MAX(rev_id)', false, __FUNCTION__ );
if ( is_null( $start ) || is_null( $end ) ) {
}
$this->output( "Populating rev_parent_id column\n" );
$start = $db->selectField( 'revision', 'MIN(rev_id)', false, __FUNCTION__ );
$end = $db->selectField( 'revision', 'MAX(rev_id)', false, __FUNCTION__ );
if ( is_null( $start ) || is_null( $end ) ) {
- $this->output( "...revision table seems to be empty.\n" );
- $db->insert( 'updatelog',
- array( 'ul_key' => 'populate rev_parent_id' ),
- __METHOD__,
- 'IGNORE' );
- return;
+ $this->output( "...revision table seems to be empty, nothing to do.\n" );
+ return true;
$cond = "rev_id BETWEEN $blockStart AND $blockEnd";
$res = $db->select( 'revision',
array( 'rev_id', 'rev_page', 'rev_timestamp', 'rev_parent_id' ),
$cond = "rev_id BETWEEN $blockStart AND $blockEnd";
$res = $db->select( 'revision',
array( 'rev_id', 'rev_page', 'rev_timestamp', 'rev_parent_id' ),
# Go through and update rev_parent_id from these rows.
# Assume that the previous revision of the title was
# the original previous revision of the title when the
# Go through and update rev_parent_id from these rows.
# Assume that the previous revision of the title was
# the original previous revision of the title when the
- wfWaitForSlaves( 5 );
- }
- $logged = $db->insert( 'updatelog',
- array( 'ul_key' => 'populate rev_parent_id' ),
- __METHOD__,
- 'IGNORE' );
- if ( $logged ) {
- $this->output( "rev_parent_id population complete ... {$count} rows [{$changed} changed]\n" );
- return true;
- } else {
- $this->output( "Could not insert rev_parent_id population row.\n" );
- return false;