From 2a3f99b2cd4191c379af476474f2365f14436aec Mon Sep 17 00:00:00 2001 From: Sean Harvey Date: Wed, 13 Aug 2014 14:46:04 +1200 Subject: [PATCH] Removing unused static funcs and moving existing statics to top of class. --- code/tasks/CheckExternalLinksTask.php | 64 ++++++++++----------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/code/tasks/CheckExternalLinksTask.php b/code/tasks/CheckExternalLinksTask.php index 97e61c6..6c3fadf 100644 --- a/code/tasks/CheckExternalLinksTask.php +++ b/code/tasks/CheckExternalLinksTask.php @@ -2,6 +2,26 @@ 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 * @@ -11,11 +31,9 @@ class CheckExternalLinksTask extends BuildTask { if(!$this->silent) Debug::message($message); } - /** - * @var bool - */ - protected $silent = false; - + public function run($request) { + $this->runLinksCheck(); + } /** * Turn on or off message output * @@ -25,25 +43,6 @@ class CheckExternalLinksTask extends BuildTask { $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 */ @@ -58,7 +57,6 @@ class CheckExternalLinksTask extends BuildTask { return $this->linkChecker; } - /** * Check the status of a single link on a page * @@ -167,20 +165,6 @@ class CheckExternalLinksTask extends BuildTask { 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) { $noPages = BrokenExternalPageTrack::get() ->filter(array( @@ -188,7 +172,7 @@ class CheckExternalLinksTask extends BuildTask { 'Processed' => 1 )) ->count(); - $track = $this->getLatestTrack($trackID); + $track = BrokenExternalPageTrackStatus::get_latest(); $track->CompletedPages = $noPages; $track->write(); return $noPages;