Changeset View
Changeset View
Standalone View
Standalone View
src/applications/owners/storage/PhabricatorOwnersPackage.php
| Show First 20 Lines • Show All 212 Lines • ▼ Show 20 Lines | $repository_clause = qsprintf( | ||||
| $repository->getPHID()); | $repository->getPHID()); | ||||
| // NOTE: The list of $paths may be very large if we're coming from | // NOTE: The list of $paths may be very large if we're coming from | ||||
| // the OwnersWorker and processing, e.g., an SVN commit which created a new | // the OwnersWorker and processing, e.g., an SVN commit which created a new | ||||
| // branch. Break it apart so that it will fit within 'max_allowed_packet', | // branch. Break it apart so that it will fit within 'max_allowed_packet', | ||||
| // and then merge results in PHP. | // and then merge results in PHP. | ||||
| $rows = array(); | $rows = array(); | ||||
| foreach (array_chunk(array_keys($fragments), 128) as $chunk) { | foreach (array_chunk(array_keys($fragments), 1024) as $chunk) { | ||||
| $indexes = array(); | |||||
| foreach ($chunk as $fragment) { | |||||
| $indexes[] = PhabricatorHash::digestForIndex($fragment); | |||||
| } | |||||
| $rows[] = queryfx_all( | $rows[] = queryfx_all( | ||||
| $conn, | $conn, | ||||
| 'SELECT pkg.id, pkg.dominion, p.excluded, p.path | 'SELECT pkg.id, pkg.dominion, p.excluded, p.path | ||||
| FROM %T pkg JOIN %T p ON p.packageID = pkg.id | FROM %T pkg JOIN %T p ON p.packageID = pkg.id | ||||
| WHERE p.path IN (%Ls) AND pkg.status IN (%Ls) %Q', | WHERE p.pathIndex IN (%Ls) AND pkg.status IN (%Ls) %Q', | ||||
| $package->getTableName(), | $package->getTableName(), | ||||
| $path->getTableName(), | $path->getTableName(), | ||||
| $chunk, | $indexes, | ||||
| array( | array( | ||||
| self::STATUS_ACTIVE, | self::STATUS_ACTIVE, | ||||
| ), | ), | ||||
| $repository_clause); | $repository_clause); | ||||
| } | } | ||||
| $rows = array_mergev($rows); | $rows = array_mergev($rows); | ||||
| $ids = self::findLongestPathsPerPackage($rows, $fragments); | $ids = self::findLongestPathsPerPackage($rows, $fragments); | ||||
| ▲ Show 20 Lines • Show All 415 Lines • Show Last 20 Lines | |||||