4 * Background job to update links for a given title.
8 class RefreshLinksJob
extends Job
{
10 function __construct( $title, $params = '', $id = 0 ) {
11 parent
::__construct( 'refreshLinks', $title, $params, $id );
15 * Run a refreshLinks job
16 * @return boolean success
20 wfProfileIn( __METHOD__
);
22 $linkCache = LinkCache
::singleton();
25 if ( is_null( $this->title
) ) {
26 $this->error
= "refreshLinks: Invalid title";
27 wfProfileOut( __METHOD__
);
31 $revision = Revision
::newFromTitle( $this->title
);
33 $this->error
= 'refreshLinks: Article not found "' . $this->title
->getPrefixedDBkey() . '"';
34 wfProfileOut( __METHOD__
);
38 wfProfileIn( __METHOD__
.'-parse' );
39 $options = new ParserOptions
;
40 $parserOutput = $wgParser->parse( $revision->getText(), $this->title
, $options, true, true, $revision->getId() );
41 wfProfileOut( __METHOD__
.'-parse' );
42 wfProfileIn( __METHOD__
.'-update' );
43 $update = new LinksUpdate( $this->title
, $parserOutput, false );
45 wfProfileOut( __METHOD__
.'-update' );
46 wfProfileOut( __METHOD__
);