4 * Background job to update links for a given title.
6 class RefreshLinksJob
extends Job
{
8 function __construct( $title, $params = '', $id = 0 ) {
9 parent
::__construct( 'refreshLinks', $title, $params, $id );
13 * Run a refreshLinks job
14 * @return boolean success
18 wfProfileIn( __METHOD__
);
20 $linkCache = LinkCache
::singleton();
23 if ( is_null( $this->title
) ) {
24 $this->error
= "refreshLinks: Invalid title";
25 wfProfileOut( __METHOD__
);
29 $revision = Revision
::newFromTitle( $this->title
);
31 $this->error
= 'refreshLinks: Article not found "' . $this->title
->getPrefixedDBkey() . '"';
32 wfProfileOut( __METHOD__
);
36 wfProfileIn( __METHOD__
.'-parse' );
37 $options = new ParserOptions
;
38 $parserOutput = $wgParser->parse( $revision->getText(), $this->title
, $options, true, true, $revision->getId() );
39 wfProfileOut( __METHOD__
.'-parse' );
40 wfProfileIn( __METHOD__
.'-update' );
41 $update = new LinksUpdate( $this->title
, $parserOutput, false );
43 wfProfileOut( __METHOD__
.'-update' );
44 wfProfileOut( __METHOD__
);