From 13114afe08ffed974ef122033829f717149150bf Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 4 Aug 2023 10:30:56 -0400 Subject: [PATCH] Update Page::matches() to perform comparison with database rather than in-memory per processwire/processwire-issues#1701 --- wire/core/PageComparison.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/wire/core/PageComparison.php b/wire/core/PageComparison.php index d5f1a5d0..930b66b8 100644 --- a/wire/core/PageComparison.php +++ b/wire/core/PageComparison.php @@ -5,7 +5,7 @@ * * Provides implementation for Page comparison functions. * - * ProcessWire 3.x, Copyright 2020 by Ryan Cramer + * ProcessWire 3.x, Copyright 2023 by Ryan Cramer * https://processwire.com * */ @@ -237,7 +237,14 @@ class PageComparison { // unknown data type to match return false; } + + $selectors->add(new SelectorEqual('id', $page->id))->add(new SelectorEqual('include', 'all')); + + return $page->wire()->pages->count($selectors) > 0; + /* + * the following is for performing in-memory matches, left here for reference + * $matches = false; foreach($selectors as $selector) { @@ -269,6 +276,7 @@ class PageComparison { } return $matches; + */ } /**