NEW: Plat-59 Do not display broken previous report info for the latest report

This commit is contained in:
Kirk Mayo 2014-08-06 15:11:23 +12:00
parent 6bda4dcc82
commit f55a650d24
3 changed files with 12 additions and 3 deletions

View File

@ -8,7 +8,8 @@ class BrokenExternalLink extends DataObject {
);
private static $has_one = array(
'Page' => 'Page'
'Page' => 'Page',
'Track' => 'BrokenExternalLink'
);
public static $summary_fields = array(

View File

@ -34,7 +34,8 @@ class BrokenExternalLinksReport extends SS_Report {
* @return string
*/
public function title() {
return _t('ExternalBrokenLinksReport.EXTERNALBROKENLINKS',"External broken links report");
return _t('ExternalBrokenLinksReport.EXTERNALBROKENLINKS',
"External broken links report");
}
/**
@ -56,8 +57,14 @@ class BrokenExternalLinksReport extends SS_Report {
}
public function sourceRecords() {
$track = CheckExternalLinks::getLatestTrack();
$returnSet = new ArrayList();
$links = BrokenExternalLink::get();
if ($track && $track->exists()) {
$links = BrokenExternalLink::get()
->filter('TrackID', $track->ID);
} else {
$links = BrokenExternalLink::get();
}
foreach ($links as $link) {
$link->PageLink = $link->Page()->Title;
$link->ID = $link->Page()->ID;

View File

@ -124,6 +124,7 @@ class CheckExternalLinks extends BuildTask {
$brokenLink->PageID = $page->ID;
$brokenLink->Link = $href;
$brokenLink->HTTPCode = $httpCode;
$brokenLink->TrackID = $track->ID;
$brokenLink->write();
// set the broken link class