From c331dedae929478c971348a5cfd431d99ea09bbd Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Wed, 1 Nov 2017 16:33:16 +1300 Subject: [PATCH 1/3] BUG Fix ambiguous query for content report --- code/Reports/EmptyPagesReport.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/code/Reports/EmptyPagesReport.php b/code/Reports/EmptyPagesReport.php index f8771b87..63466ef7 100644 --- a/code/Reports/EmptyPagesReport.php +++ b/code/Reports/EmptyPagesReport.php @@ -2,6 +2,7 @@ namespace SilverStripe\CMS\Reports; +use SilverStripe\CMS\Model\RedirectorPage; use SilverStripe\CMS\Model\SiteTree; use SilverStripe\Reports\Report; @@ -25,9 +26,10 @@ class EmptyPagesReport extends Report public function sourceRecords($params = null) { - return SiteTree::get()->where( - "\"ClassName\" != 'RedirectorPage' AND (\"Content\" = '' OR \"Content\" IS NULL OR \"Content\" LIKE '

' OR \"Content\" LIKE '

 

')" - )->sort('Title'); + return SiteTree::get() + ->exclude('SiteTree.ClassName', RedirectorPage::class) + ->filter('SiteTree.Content', [null, '', '

', '

 

']) + ->sort('Title'); } public function columns() From 094633291529687143ad7a0fa3fc310293fa099c Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Wed, 1 Nov 2017 17:19:04 +1300 Subject: [PATCH 2/3] Remove table prefix --- code/Reports/EmptyPagesReport.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/code/Reports/EmptyPagesReport.php b/code/Reports/EmptyPagesReport.php index 63466ef7..025a5243 100644 --- a/code/Reports/EmptyPagesReport.php +++ b/code/Reports/EmptyPagesReport.php @@ -27,8 +27,8 @@ class EmptyPagesReport extends Report public function sourceRecords($params = null) { return SiteTree::get() - ->exclude('SiteTree.ClassName', RedirectorPage::class) - ->filter('SiteTree.Content', [null, '', '

', '

 

']) + ->exclude('ClassName', RedirectorPage::class) + ->filter('Content', [null, '', '

', '

 

']) ->sort('Title'); } From 6c2d5311d378aeb370e87490319c8166880102c9 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Wed, 1 Nov 2017 17:19:04 +1300 Subject: [PATCH 3/3] Docblock --- code/Reports/EmptyPagesReport.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/code/Reports/EmptyPagesReport.php b/code/Reports/EmptyPagesReport.php index 025a5243..2d76faf4 100644 --- a/code/Reports/EmptyPagesReport.php +++ b/code/Reports/EmptyPagesReport.php @@ -4,6 +4,7 @@ namespace SilverStripe\CMS\Reports; use SilverStripe\CMS\Model\RedirectorPage; use SilverStripe\CMS\Model\SiteTree; +use SilverStripe\ORM\DataList; use SilverStripe\Reports\Report; class EmptyPagesReport extends Report @@ -24,6 +25,12 @@ class EmptyPagesReport extends Report return 100; } + /** + * Gets the source records + * + * @param array $params + * @return DataList + */ public function sourceRecords($params = null) { return SiteTree::get()