1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-16 03:34:33 +02:00

Update Page::matches() to perform comparison with database rather than in-memory per processwire/processwire-issues#1701

This commit is contained in:
Ryan Cramer
2023-08-04 10:30:56 -04:00
parent 6266d1d86b
commit 13114afe08

View File

@@ -5,7 +5,7 @@
* *
* Provides implementation for Page comparison functions. * 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 * https://processwire.com
* *
*/ */
@@ -238,6 +238,13 @@ class PageComparison {
return false; 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; $matches = false;
foreach($selectors as $selector) { foreach($selectors as $selector) {
@@ -269,6 +276,7 @@ class PageComparison {
} }
return $matches; return $matches;
*/
} }
/** /**