FIX: Optimise PagesWithoutReviewScheduleReport database query

Drastically speeds up report generation on very large sites and reduces the likelyhood of running into memory issues.
This commit is contained in:
GuySartorelli 2021-05-26 12:18:17 +12:00 committed by GitHub
parent c15888277d
commit 2fee654bb6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 5 deletions

View File

@ -111,7 +111,7 @@ class PagesWithoutReviewScheduleReport extends Report
{
Versioned::set_stage(Versioned::DRAFT);
$records = SiteTree::get();
$records = SiteTree::get()->filter('NextReviewDate', null);
$compatibility = ContentReviewCompatability::start();
// If there's no review dates set, default to all pages due for review now.
@ -148,10 +148,6 @@ class PagesWithoutReviewScheduleReport extends Report
*/
protected function hasReviewSchedule(DataObject $record)
{
if (!$record->obj("NextReviewDate")->exists()) {
return false;
}
$options = $record->getOptions();
if ($options && $options->OwnerGroups()->count() == 0 && $options->OwnerUsers()->count() == 0) {