Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/query/policy/PhabricatorPolicyAwareQuery.php
Show First 20 Lines • Show All 276 Lines • ▼ Show 20 Lines | do { | ||||
foreach ($maybe_visible as $key => $object) { | foreach ($maybe_visible as $key => $object) { | ||||
if (empty($visible[$key])) { | if (empty($visible[$key])) { | ||||
$removed[$key] = $object; | $removed[$key] = $object; | ||||
} | } | ||||
} | } | ||||
$this->didFilterResults($removed); | $this->didFilterResults($removed); | ||||
// NOTE: We call "nextPage()" before checking if we've found enough | |||||
// results because we want to build the internal cursor object even | |||||
// if we don't need to execute another query: the internal cursor may | |||||
// be used by a parent query that is using this query to translate an | |||||
// external cursor into an internal cursor. | |||||
$this->nextPage($page); | |||||
foreach ($visible as $key => $result) { | foreach ($visible as $key => $result) { | ||||
++$count; | ++$count; | ||||
// If we have an offset, we just ignore that many results and start | // If we have an offset, we just ignore that many results and start | ||||
// storing them only once we've hit the offset. This reduces memory | // storing them only once we've hit the offset. This reduces memory | ||||
// requirements for large offsets, compared to storing them all and | // requirements for large offsets, compared to storing them all and | ||||
// slicing them away later. | // slicing them away later. | ||||
if ($count > $offset) { | if ($count > $offset) { | ||||
Show All 14 Lines | do { | ||||
if (count($page) < $this->rawResultLimit) { | if (count($page) < $this->rawResultLimit) { | ||||
// If we have a load count but the unfiltered results contained fewer | // If we have a load count but the unfiltered results contained fewer | ||||
// objects, we know this was the last page of objects; we do not need | // objects, we know this was the last page of objects; we do not need | ||||
// to load another page because we can deduce it would be empty. | // to load another page because we can deduce it would be empty. | ||||
break; | break; | ||||
} | } | ||||
$this->nextPage($page); | |||||
if ($overheat_limit && ($total_seen >= $overheat_limit)) { | if ($overheat_limit && ($total_seen >= $overheat_limit)) { | ||||
$this->isOverheated = true; | $this->isOverheated = true; | ||||
break; | break; | ||||
} | } | ||||
} while (true); | } while (true); | ||||
$results = $this->didLoadResults($results); | $results = $this->didLoadResults($results); | ||||
▲ Show 20 Lines • Show All 427 Lines • Show Last 20 Lines |