mirror of
https://github.com/silverstripe/silverstripe-externallinks.git
synced 2024-10-22 17:05:44 +02:00
Merge pull request #6 from halkyon/vis_changes
Removing unused static funcs and moving existing statics to top of class
This commit is contained in:
commit
2a286fd582
@ -2,6 +2,26 @@
|
|||||||
|
|
||||||
class CheckExternalLinksTask extends BuildTask {
|
class CheckExternalLinksTask extends BuildTask {
|
||||||
|
|
||||||
|
private static $dependencies = array(
|
||||||
|
'LinkChecker' => '%$LinkChecker'
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
protected $silent = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var LinkChecker
|
||||||
|
*/
|
||||||
|
protected $linkChecker;
|
||||||
|
|
||||||
|
protected $title = 'Checking broken External links in the SiteTree';
|
||||||
|
|
||||||
|
protected $description = 'A task that records external broken links in the SiteTree';
|
||||||
|
|
||||||
|
protected $enabled = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Log a message
|
* Log a message
|
||||||
*
|
*
|
||||||
@ -11,11 +31,9 @@ class CheckExternalLinksTask extends BuildTask {
|
|||||||
if(!$this->silent) Debug::message($message);
|
if(!$this->silent) Debug::message($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function run($request) {
|
||||||
* @var bool
|
$this->runLinksCheck();
|
||||||
*/
|
}
|
||||||
protected $silent = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Turn on or off message output
|
* Turn on or off message output
|
||||||
*
|
*
|
||||||
@ -25,25 +43,6 @@ class CheckExternalLinksTask extends BuildTask {
|
|||||||
$this->silent = $silent;
|
$this->silent = $silent;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $title = 'Checking broken External links in the SiteTree';
|
|
||||||
|
|
||||||
protected $description = 'A task that records external broken links in the SiteTree';
|
|
||||||
|
|
||||||
protected $enabled = true;
|
|
||||||
|
|
||||||
private static $dependencies = array(
|
|
||||||
'LinkChecker' => '%$LinkChecker'
|
|
||||||
);
|
|
||||||
|
|
||||||
public function run($request) {
|
|
||||||
$this->runLinksCheck();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var LinkChecker
|
|
||||||
*/
|
|
||||||
protected $linkChecker;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param LinkChecker $linkChecker
|
* @param LinkChecker $linkChecker
|
||||||
*/
|
*/
|
||||||
@ -58,7 +57,6 @@ class CheckExternalLinksTask extends BuildTask {
|
|||||||
return $this->linkChecker;
|
return $this->linkChecker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check the status of a single link on a page
|
* Check the status of a single link on a page
|
||||||
*
|
*
|
||||||
@ -167,20 +165,6 @@ class CheckExternalLinksTask extends BuildTask {
|
|||||||
return $status;
|
return $status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getLatestTrack() {
|
|
||||||
return BrokenExternalPageTrackStatus::get_latest();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getLatestTrackID() {
|
|
||||||
$track = BrokenExternalPageTrackStatus::get_latest();
|
|
||||||
return $track ? $track->ID : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function getLatestTrackStatus() {
|
|
||||||
$track = BrokenExternalPageTrackStatus::get_latest();
|
|
||||||
return $track ? $track->Status : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private function updateCompletedPages($trackID = 0) {
|
private function updateCompletedPages($trackID = 0) {
|
||||||
$noPages = BrokenExternalPageTrack::get()
|
$noPages = BrokenExternalPageTrack::get()
|
||||||
->filter(array(
|
->filter(array(
|
||||||
@ -188,7 +172,7 @@ class CheckExternalLinksTask extends BuildTask {
|
|||||||
'Processed' => 1
|
'Processed' => 1
|
||||||
))
|
))
|
||||||
->count();
|
->count();
|
||||||
$track = $this->getLatestTrack($trackID);
|
$track = BrokenExternalPageTrackStatus::get_latest();
|
||||||
$track->CompletedPages = $noPages;
|
$track->CompletedPages = $noPages;
|
||||||
$track->write();
|
$track->write();
|
||||||
return $noPages;
|
return $noPages;
|
||||||
|
Loading…
Reference in New Issue
Block a user