Changeset View
Changeset View
Standalone View
Standalone View
src/applications/diffusion/controller/DiffusionLintController.php
| Show First 20 Lines • Show All 270 Lines • ▼ Show 20 Lines | if ($owner_phids) { | ||||
| $path->getRepositoryPHID())); | $path->getRepositoryPHID())); | ||||
| if ($branch) { | if ($branch) { | ||||
| $condition = qsprintf( | $condition = qsprintf( | ||||
| $conn, | $conn, | ||||
| '(branchID IN (%Ld) AND path LIKE %>)', | '(branchID IN (%Ld) AND path LIKE %>)', | ||||
| array_keys($branch), | array_keys($branch), | ||||
| $path->getPath()); | $path->getPath()); | ||||
| if ($path->getExcluded()) { | if ($path->getExcluded()) { | ||||
| $where[] = 'NOT '.$condition; | $where[] = qsprintf($conn, 'NOT %Q', $condition); | ||||
| } else { | } else { | ||||
| $or[] = $condition; | $or[] = $condition; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| $where[] = '('.implode(' OR ', $or).')'; | $where[] = qsprintf($conn, '%LO', $or); | ||||
| } | } | ||||
| return queryfx_all( | return queryfx_all( | ||||
| $conn, | $conn, | ||||
| 'SELECT | 'SELECT | ||||
| branchID, | branchID, | ||||
| code, | code, | ||||
| MAX(severity) AS maxSeverity, | MAX(severity) AS maxSeverity, | ||||
| MAX(name) AS maxName, | MAX(name) AS maxName, | ||||
| MAX(description) AS maxDescription, | MAX(description) AS maxDescription, | ||||
| COUNT(DISTINCT path) AS files, | COUNT(DISTINCT path) AS files, | ||||
| COUNT(*) AS n | COUNT(*) AS n | ||||
| FROM %T | FROM %T | ||||
| WHERE %Q | WHERE %LA | ||||
| GROUP BY branchID, code | GROUP BY branchID, code | ||||
| ORDER BY n DESC', | ORDER BY n DESC', | ||||
| PhabricatorRepository::TABLE_LINTMESSAGE, | PhabricatorRepository::TABLE_LINTMESSAGE, | ||||
| implode(' AND ', $where)); | $where); | ||||
| } | } | ||||
| protected function buildActionView(DiffusionRequest $drequest) { | protected function buildActionView(DiffusionRequest $drequest) { | ||||
| $viewer = $this->getRequest()->getUser(); | $viewer = $this->getRequest()->getUser(); | ||||
| $view = id(new PhabricatorActionListView()) | $view = id(new PhabricatorActionListView()) | ||||
| ->setUser($viewer); | ->setUser($viewer); | ||||
| ▲ Show 20 Lines • Show All 209 Lines • ▼ Show 20 Lines | if ($drequest->getLint() != '') { | ||||
| 'code = %s', | 'code = %s', | ||||
| $drequest->getLint()); | $drequest->getLint()); | ||||
| } | } | ||||
| return queryfx_all( | return queryfx_all( | ||||
| $conn, | $conn, | ||||
| 'SELECT * | 'SELECT * | ||||
| FROM %T | FROM %T | ||||
| WHERE %Q | WHERE %LA | ||||
| ORDER BY path, code, line LIMIT %d OFFSET %d', | ORDER BY path, code, line LIMIT %d OFFSET %d', | ||||
| PhabricatorRepository::TABLE_LINTMESSAGE, | PhabricatorRepository::TABLE_LINTMESSAGE, | ||||
| implode(' AND ', $where), | $where, | ||||
| $limit, | $limit, | ||||
| $offset); | $offset); | ||||
| } | } | ||||
| } | } | ||||