2013-08-26 12:24:36 +12:00
|
|
|
<?php
|
|
|
|
|
2014-07-28 11:23:33 +12:00
|
|
|
if(!class_exists('AbstractQueuedJob')) return;
|
|
|
|
|
2013-08-26 12:24:36 +12:00
|
|
|
/**
|
2014-07-24 14:20:48 +12:00
|
|
|
* A Job for running a external link check for published pages
|
2013-08-26 12:24:36 +12:00
|
|
|
*
|
|
|
|
*/
|
2014-07-24 14:20:48 +12:00
|
|
|
class CheckExternalLinksJob extends AbstractQueuedJob implements QueuedJob {
|
2013-08-26 12:24:36 +12:00
|
|
|
|
|
|
|
public function getTitle() {
|
2014-07-28 11:23:33 +12:00
|
|
|
return _t('CheckExternalLiksJob.TITLE', 'Checking for external broken links');
|
2013-08-26 12:24:36 +12:00
|
|
|
}
|
|
|
|
|
2014-07-24 14:20:48 +12:00
|
|
|
public function getJobType() {
|
|
|
|
return QueuedJob::QUEUED;
|
|
|
|
}
|
|
|
|
|
2013-08-26 12:24:36 +12:00
|
|
|
public function getSignature() {
|
|
|
|
return md5(get_class($this));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-08-04 11:20:54 +12:00
|
|
|
* Check an individual page
|
2013-08-26 12:24:36 +12:00
|
|
|
*/
|
|
|
|
public function process() {
|
2014-08-07 13:56:15 +12:00
|
|
|
$task = CheckExternalLinksTask::create();
|
2014-08-04 11:20:54 +12:00
|
|
|
$track = $task->runLinksCheck(1);
|
|
|
|
$this->currentStep = $track->CompletedPages;
|
|
|
|
$this->totalSteps = $track->TotalPages;
|
|
|
|
$this->isComplete = $track->Status === 'Completed';
|
2013-08-26 12:24:36 +12:00
|
|
|
}
|
2014-07-24 14:20:48 +12:00
|
|
|
|
|
|
|
}
|