class Job {
var $command,
$title,
- $params,
+ $params,
$id,
- $removeDuplicates,
+ $removeDuplicates,
$error;
/*-------------------------------------------------------------------------
*------------------------------------------------------------------------*/
/**
* Add an array of refreshLinks jobs to the queue
- * @param array $titles Array of title objects.
+ * @param array $titles Array of title objects.
* @static
*/
function queueLinksJobs( $titles ) {
$dbr =& wfGetDB( DB_SLAVE );
// Get a job from the slave
- $row = $dbr->selectRow( 'job', '*', '', $fname,
+ $row = $dbr->selectRow( 'job', '*', '', $fname,
array( 'ORDER BY' => 'job_id', 'LIMIT' => 1 )
);
if ( !$affected ) {
// Failed, someone else beat us to it
// Try getting a random row
- $row = $dbw->selectRow( 'job', array( 'MIN(job_id) as minjob',
+ $row = $dbw->selectRow( 'job', array( 'MIN(job_id) as minjob',
'MAX(job_id) as maxjob' ), '', $fname );
if ( $row === false || is_null( $row->minjob ) || is_null( $row->maxjob ) ) {
// No jobs to get
return false;
}
// Get the random row
- $row = $dbw->selectRow( 'job', '*',
+ $row = $dbw->selectRow( 'job', '*',
array( 'job_id' => mt_rand( $row->minjob, $row->maxjob ) ), $fname );
if ( $row === false ) {
// Random job gone before we got the chance to select it
// Give up
wfProfileOut( $fname );
return false;
- }
+ }
}
// If execution got to here, there's a row in $row that has been deleted from the database
*/
function refreshLinks() {
global $wgParser;
+ $fname = 'Job::refreshLinks';
+ wfProfileIn( $fname );
$dbw =& wfGetDB( DB_MASTER );
if ( is_null( $this->title ) ) {
$this->error = "refreshLinks: Invalid title";
+ wfProfileOut( $fname );
return false;
}
$revision = Revision::newFromTitle( $this->title );
if ( !$revision ) {
$this->error = 'refreshLinks: Article not found "' . $this->title->getPrefixedDBkey() . '"';
+ wfProfileOut( $fname );
return false;
}
+ wfProfileIn( "$fname-parse" );
$options = new ParserOptions;
$parserOutput = $wgParser->parse( $revision->getText(), $this->title, $options, true, true, $revision->getId() );
+ wfProfileOut( "$fname-parse" );
+ wfProfileIn( "$fname-update" );
$update = new LinksUpdate( $this->title, $parserOutput, false );
$update->doUpdate();
+ wfProfileOut( "$fname-update" );
+ wfProfileOut( $fname );
return true;
}
return $s;
} else {
return "{$this->command} {$this->params}";
- }
+ }
}
function getLastError() {
return $this->error;
}
}
+?>