Merge pull request #2011 from open-sausages/pulls/4.0/dont-give-me-a-falsified-report

BUG Fix ambiguous query for content report
This commit is contained in:
Damian Mooyman 2017-11-02 12:03:13 +13:00 committed by GitHub
commit a9cc93749d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,7 +2,9 @@
namespace SilverStripe\CMS\Reports; namespace SilverStripe\CMS\Reports;
use SilverStripe\CMS\Model\RedirectorPage;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\ORM\DataList;
use SilverStripe\Reports\Report; use SilverStripe\Reports\Report;
class EmptyPagesReport extends Report class EmptyPagesReport extends Report
@ -23,11 +25,18 @@ class EmptyPagesReport extends Report
return 100; return 100;
} }
/**
* Gets the source records
*
* @param array $params
* @return DataList
*/
public function sourceRecords($params = null) public function sourceRecords($params = null)
{ {
return SiteTree::get()->where( return SiteTree::get()
"\"ClassName\" != 'RedirectorPage' AND (\"Content\" = '' OR \"Content\" IS NULL OR \"Content\" LIKE '<p></p>' OR \"Content\" LIKE '<p>&nbsp;</p>')" ->exclude('ClassName', RedirectorPage::class)
)->sort('Title'); ->filter('Content', [null, '', '<p></p>', '<p>&nbsp;</p>'])
->sort('Title');
} }
public function columns() public function columns()