1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-09 08:17:12 +02:00

Update the PageArrayIterator::$chunkSize setting to be configurable via $config->lazyPageChunkSize per @apeisa

This commit is contained in:
Ryan Cramer
2016-12-16 11:12:23 -05:00
parent ffde966920
commit 8d8d9dfe3d
3 changed files with 11 additions and 2 deletions

View File

@@ -1129,6 +1129,14 @@ $config->allowExceptions = false;
*/
$config->usePoweredBy = true;
/**
* Chunk size for lazy-loaded pages used by $pages->findMany()
*
* @var int
*
*/
$config->lazyPageChunkSize = 250;
/**
* Settings specific to InputfieldWrapper class
*

View File

@@ -121,6 +121,7 @@
* @property bool $allowExceptions Allow Exceptions to propagate? (default=false, specify true only if you implement your own exception handler) #pw-group-system
* @property bool $usePoweredBy Use the x-powered-by header? Set to false to disable. #pw-group-system
* @property bool $useFunctionsAPI Allow most API variables to be accessed as functions? (see /wire/core/FunctionsAPI.php) #pw-group-system
* @property int $lazyPageChunkSize Chunk size for for $pages->findMany() calls. #pw-group-system
*
* @property string $userAuthSalt Salt generated at install time to be used as a secondary/non-database salt for the password system. #pw-group-session
* @property string $userAuthHashType Default is 'sha1' - used only if Blowfish is not supported by the system. #pw-group-session

View File

@@ -73,7 +73,7 @@ class PageArrayIterator extends Wire implements \Iterator {
* @var int
*
*/
protected $chunkSize = 1000;
protected $chunkSize = 250;
/**
* Construct
@@ -92,7 +92,7 @@ class PageArrayIterator extends Wire implements \Iterator {
*
*/
protected function loadChunk() {
$this->chunkSize = (int) $this->wire('config')->lazyPageChunkSize;
$this->pagesPosition = 0;
$start = $this->currentChunk++ * $this->chunkSize;