From 62f84637e0d68ca61caa8a9d58fa93f3c8fce9b4 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Wed, 13 Oct 2010 04:19:22 +0000 Subject: [PATCH] BUGFIX: Use correct quoting for BrokenLinksReport (ticket #5474) (from r103706) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@112173 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- code/reports/BrokenLinksReport.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/code/reports/BrokenLinksReport.php b/code/reports/BrokenLinksReport.php index 40bbcee4..cf9e1d41 100644 --- a/code/reports/BrokenLinksReport.php +++ b/code/reports/BrokenLinksReport.php @@ -29,9 +29,9 @@ class BrokenLinksReport extends SS_Report { $sort = ''; } } - - if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') $ret = Versioned::get_by_stage('SiteTree', 'Live', "(HasBrokenLink = 1 OR HasBrokenFile = 1)", $sort, $join, $limit); - else $ret = DataObject::get('SiteTree', "(HasBrokenFile = 1 OR HasBrokenLink = 1)", $sort, $join, $limit); + $q = DB::USE_ANSI_SQL ? '"' : '`'; + if (!isset($_REQUEST['CheckSite']) || $params['CheckSite'] == 'Published') $ret = Versioned::get_by_stage('SiteTree', 'Live', "({$q}SiteTree{$q}.{$q}HasBrokenLink{$q} = 1 OR {$q}SiteTree{$q}.{$q}HasBrokenFile{$q} = 1)", $sort, $join, $limit); + else $ret = DataObject::get('SiteTree', "({$q}SiteTree{$q}.{$q}HasBrokenFile{$q} = 1 OR {$q}HasBrokenLink{$q} = 1)", $sort, $join, $limit); $returnSet = new DataObjectSet(); if ($ret) foreach($ret as $record) {