Changeset View
Changeset View
Standalone View
Standalone View
src/applications/differential/query/DifferentialHunkQuery.php
Show All 24 Lines | protected function willExecute() { | ||||
// end up with the right result. | // end up with the right result. | ||||
if ($this->shouldAttachToChangesets) { | if ($this->shouldAttachToChangesets) { | ||||
foreach ($this->changesets as $changeset) { | foreach ($this->changesets as $changeset) { | ||||
$changeset->attachHunks(array()); | $changeset->attachHunks(array()); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
protected function loadPage() { | protected function loadPage() { | ||||
$all_results = array(); | $table = new DifferentialHunk(); | ||||
epriestley: `$all_results` and comment both obsolete now? | |||||
// Load modern hunks. | |||||
$table = new DifferentialModernHunk(); | |||||
$conn_r = $table->establishConnection('r'); | |||||
$modern_data = queryfx_all( | |||||
$conn_r, | |||||
'SELECT * FROM %T %Q %Q %Q', | |||||
$table->getTableName(), | |||||
$this->buildWhereClause($conn_r), | |||||
$this->buildOrderClause($conn_r), | |||||
$this->buildLimitClause($conn_r)); | |||||
$modern_results = $table->loadAllFromArray($modern_data); | |||||
// Now, load legacy hunks. | |||||
$table = new DifferentialLegacyHunk(); | |||||
$conn_r = $table->establishConnection('r'); | $conn_r = $table->establishConnection('r'); | ||||
$legacy_data = queryfx_all( | $data = queryfx_all( | ||||
$conn_r, | $conn_r, | ||||
'SELECT * FROM %T %Q %Q %Q', | 'SELECT * FROM %T %Q %Q %Q', | ||||
$table->getTableName(), | $table->getTableName(), | ||||
$this->buildWhereClause($conn_r), | $this->buildWhereClause($conn_r), | ||||
$this->buildOrderClause($conn_r), | $this->buildOrderClause($conn_r), | ||||
$this->buildLimitClause($conn_r)); | $this->buildLimitClause($conn_r)); | ||||
$legacy_results = $table->loadAllFromArray($legacy_data); | return $table->loadAllFromArray($data); | ||||
// Strip all the IDs off since they're not unique and nothing should be | |||||
// using them. | |||||
return array_values(array_merge($legacy_results, $modern_results)); | |||||
} | } | ||||
protected function willFilterPage(array $hunks) { | protected function willFilterPage(array $hunks) { | ||||
$changesets = mpull($this->changesets, null, 'getID'); | $changesets = mpull($this->changesets, null, 'getID'); | ||||
foreach ($hunks as $key => $hunk) { | foreach ($hunks as $key => $hunk) { | ||||
$changeset = idx($changesets, $hunk->getChangesetID()); | $changeset = idx($changesets, $hunk->getChangesetID()); | ||||
if (!$changeset) { | if (!$changeset) { | ||||
unset($hunks[$key]); | unset($hunks[$key]); | ||||
▲ Show 20 Lines • Show All 49 Lines • Show Last 20 Lines |
$all_results and comment both obsolete now?