From 7bc486a5123e3d5564e29e9204275adb8a1e2f2d Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Thu, 4 Feb 2010 04:53:36 +0000 Subject: [PATCH] MINOR fix sorting in this report. (from r96481) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/branches/2.4@98196 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/reports/BrokenLinksReport.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/code/reports/BrokenLinksReport.php b/code/reports/BrokenLinksReport.php index b3620bc8..30d88a2f 100644 --- a/code/reports/BrokenLinksReport.php +++ b/code/reports/BrokenLinksReport.php @@ -10,9 +10,10 @@ class BrokenLinksReport extends SSReport { function title() { return _t('BrokenLinksReport.BROKENLINKS',"Broken links report"); } - function sourceRecords($params = null) { - if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') $ret = Versioned::get_by_stage('SiteTree', 'Live', "(HasBrokenLink = 1 OR HasBrokenFile = 1)"); - else $ret = DataObject::get('SiteTree', "(HasBrokenFile = 1 OR HasBrokenLink = 1)"); + function sourceRecords($params, $sort, $limit) { + if(!$sort || !in_array(preg_replace('/(\s+?)(A|DE)SC$/', '', $sort), array('Title','LastEdited'))) $sort = "LastEdited ASC"; + if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') $ret = Versioned::get_by_stage('SiteTree', 'Live', "(HasBrokenLink = 1 OR HasBrokenFile = 1)", $sort); + else $ret = DataObject::get('SiteTree', "(HasBrokenFile = 1 OR HasBrokenLink = 1)", $sort); $returnSet = new DataObjectSet(); if ($ret) foreach($ret as $record) {