mirror of
https://github.com/silverstripe/silverstripe-externallinks.git
synced 2024-10-22 17:05:44 +02:00
NEW: Plat-59 Do not display broken previous report info for the latest report
This commit is contained in:
parent
6bda4dcc82
commit
f55a650d24
@ -8,7 +8,8 @@ class BrokenExternalLink extends DataObject {
|
||||
);
|
||||
|
||||
private static $has_one = array(
|
||||
'Page' => 'Page'
|
||||
'Page' => 'Page',
|
||||
'Track' => 'BrokenExternalLink'
|
||||
);
|
||||
|
||||
public static $summary_fields = array(
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user