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