* Constructor
*/
public function __construct( ) {
+ # noop
}
/**
- * Update link tables with outgoing links from an updated article
+ * Perform update.
*/
public abstract function doUpdate();
+ /**
+ * Conveniance method, calls doUpdate() on every element in the array.
+ *
+ * @static
+ * @param $updates array
+ */
+ public static function runUpdates( $updates ) {
+ if ( empty( $updates ) ) return; # nothing to do
+
+ foreach ( $updates as $update ) {
+ $update->doUpdate();
+ }
+ }
+
}
$parserCache->save( $editInfo->output, $this, $editInfo->popts );
}
- # Update the links tables
- $u = new LinksUpdate( $this->mTitle, $editInfo->output );
- $u->doUpdate();
+ # Update the links tables and other secondary data
+ $updates = $editInfo->output->getLinksUpdateAndOtherUpdates( $this->mTitle );
+ SecondaryDataUpdate::runUpdates( $updates );
wfRunHooks( 'ArticleEditUpdates', array( &$this, &$editInfo, $options['changed'] ) );
if ( count( $templates_diff ) > 0 ) {
# Whee, link updates time.
+ # Note: we are only interested in links here. We don't need to get other SecondaryDataUpdate items from the parser output.
$u = new LinksUpdate( $this->mTitle, $parserOutput, false );
$u->doUpdate();
}
true, true, $page->getLatest() ); #FIXME: content!
# Update the links tables
- $u = new LinksUpdate( $title, $p_result );
- $u->doUpdate();
+ $updates = $p_result->getLinksUpdateAndOtherUpdates( $title );
+ SecondaryDataUpdate::runUpdates( $updates );
$r['linkupdate'] = '';
$parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getId() );
wfProfileOut( __METHOD__.'-parse' );
wfProfileIn( __METHOD__.'-update' );
- $update = new LinksUpdate( $this->title, $parserOutput, false );
- $update->doUpdate();
- wfProfileOut( __METHOD__.'-update' );
+
+ $updates = $parserOutput->getLinksUpdateAndOtherUpdates( $this->title, false );
+ SecondaryDataUpdate::runUpdates( $updates );
+
+ wfProfileOut( __METHOD__.'-update' );
wfProfileOut( __METHOD__ );
return true;
}
$parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() );
wfProfileOut( __METHOD__.'-parse' );
wfProfileIn( __METHOD__.'-update' );
- $update = new LinksUpdate( $title, $parserOutput, false );
- $update->doUpdate();
+
+ $updates = $parserOutput->getLinksUpdateAndOtherUpdates( $title, false );
+ SecondaryDataUpdate::runUpdates( $updates );
+
wfProfileOut( __METHOD__.'-update' );
wfWaitForSlaves();
}
$options = new ParserOptions;
$parserOutput = $wgParser->parse( $revision->getText(), $title, $options, true, true, $revision->getId() );
- $update = new LinksUpdate( $title, $parserOutput, false );
- $update->doUpdate();
- $dbw->commit();
+
+ $updates = $parserOutput->getLinksUpdateAndOtherUpdates( $title, false );
+ SecondaryDataUpdate::runUpdates( $updates );
+
+ $dbw->commit();
}
/**