Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
index c052a6271d..a4c0e96ca8 100644
--- a/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
+++ b/src/applications/audit/constants/PhabricatorAuditCommitStatusConstants.php
@@ -1,27 +1,34 @@
<?php
final class PhabricatorAuditCommitStatusConstants {
const NONE = 0;
const NEEDS_AUDIT = 1;
const CONCERN_RAISED = 2;
const PARTIALLY_AUDITED = 3;
const FULLY_AUDITED = 4;
public static function getStatusNameMap() {
static $map = array(
self::NONE => 'None',
self::NEEDS_AUDIT => 'Audit Required',
self::CONCERN_RAISED => 'Concern Raised',
self::PARTIALLY_AUDITED => 'Partially Audited',
self::FULLY_AUDITED => 'Audited',
);
return $map;
}
public static function getStatusName($code) {
return idx(self::getStatusNameMap(), $code, 'Unknown');
}
+ public static function getOpenStatusConstants() {
+ return array(
+ self::CONCERN_RAISED,
+ self::NEEDS_AUDIT,
+ );
+ }
+
}
diff --git a/src/applications/audit/controller/PhabricatorAuditListController.php b/src/applications/audit/controller/PhabricatorAuditListController.php
index 090c3744cd..cd2e6bddb7 100644
--- a/src/applications/audit/controller/PhabricatorAuditListController.php
+++ b/src/applications/audit/controller/PhabricatorAuditListController.php
@@ -1,521 +1,525 @@
<?php
final class PhabricatorAuditListController extends PhabricatorAuditController {
private $filter;
private $name;
private $filterStatus;
+ private $filterConcern;
public function willProcessRequest(array $data) {
$this->filter = idx($data, 'filter');
$this->name = idx($data, 'name');
}
public function processRequest() {
$request = $this->getRequest();
$nav = $this->buildNavAndSelectFilter();
if ($request->isFormPost()) {
// If the list filter is POST'ed, redirect to GET so the page can be
// bookmarked.
$uri = $request->getRequestURI();
$phid = head($request->getArr('set_phid'));
$user = id(new PhabricatorUser())->loadOneWhere(
'phid = %s',
$phid);
$uri = $request->getRequestURI();
if ($user) {
$username = phutil_escape_uri($user->getUsername());
$uri = '/audit/view/'.$this->filter.'/'.$username.'/';
} else if ($phid) {
$uri = $request->getRequestURI();
$uri = $uri->alter('phid', $phid);
}
return id(new AphrontRedirectResponse())->setURI($uri);
}
$this->filterStatus = $request->getStr('status', 'all');
+
$handle = $this->loadHandle();
$nav->appendChild($this->buildListFilters($handle));
$title = null;
$message = null;
if (!$handle) {
switch ($this->filter) {
case 'project':
$title = pht('Choose A Project');
$message = pht('Choose a project to view audits for.');
break;
case 'repository':
$title = pht('Choose A Repository');
$message = pht('Choose a repository to view audits for.');
break;
case 'package':
case 'packagecommits':
$title = pht('Choose a Package');
$message = pht('Choose a package to view audits for.');
break;
}
}
if (!$message) {
$nav->appendChild($this->buildViews($handle));
} else {
$panel = id(new AphrontErrorView())
->setSeverity(AphrontErrorView::SEVERITY_NODATA)
->setTitle($title)
->appendChild($message);
$nav->appendChild($panel);
}
return $this->buildStandardPageResponse(
$nav,
array(
'title' => pht('Audits'),
));
}
private function buildNavAndSelectFilter() {
$nav = new AphrontSideNavFilterView();
$nav->setBaseURI(new PhutilURI('/audit/view/'));
$nav->addLabel(pht('Active'));
$nav->addFilter('active', pht('Need Attention'));
$nav->addLabel(pht('Audits'));
$nav->addFilter('audits', pht('All'));
$nav->addFilter('user', pht('By User'));
$nav->addFilter('project', pht('By Project'));
$nav->addFilter('package', pht('By Package'));
$nav->addFilter('repository', pht('By Repository'));
$nav->addLabel(pht('Commits'));
$nav->addFilter('commits', pht('All'));
$nav->addFilter('author', pht('By Author'));
$nav->addFilter('packagecommits', pht('By Package'));
$this->filter = $nav->selectFilter($this->filter, 'active');
return $nav;
}
private function buildListFilters(PhabricatorObjectHandle $handle = null) {
$request = $this->getRequest();
$user = $request->getUser();
$form = new AphrontFormView();
$form->setUser($user);
$show_status = false;
$show_user = false;
$show_project = false;
$show_package = false;
$show_repository = false;
switch ($this->filter) {
case 'audits':
case 'commits':
$show_status = true;
break;
case 'active':
$show_user = true;
break;
case 'author':
case 'user':
$show_user = true;
$show_status = true;
break;
case 'project':
$show_project = true;
$show_status = true;
break;
case 'repository':
$show_repository = true;
$show_status = true;
break;
case 'package':
case 'packagecommits':
$show_package = true;
$show_status = true;
break;
}
if ($show_user || $show_project || $show_package || $show_repository) {
if ($show_user) {
$uri = '/typeahead/common/users/';
$label = pht('User');
} else if ($show_project) {
$uri = '/typeahead/common/projects/';
$label = pht('Project');
} else if ($show_package) {
$uri = '/typeahead/common/packages/';
$label = pht('Package');
} else if ($show_repository) {
$uri = '/typeahead/common/repositories/';
$label = pht('Repository');
}
$tok_value = null;
if ($handle) {
$tok_value = array(
$handle->getPHID() => $handle->getFullName(),
);
}
$form->appendChild(
id(new AphrontFormTokenizerControl())
->setName('set_phid')
->setLabel($label)
->setLimit(1)
->setDatasource($uri)
->setValue($tok_value));
}
if ($show_status) {
$form->appendChild(
id(new AphrontFormToggleButtonsControl())
->setName('status')
->setLabel(pht('Status'))
->setBaseURI($request->getRequestURI(), 'status')
->setValue($this->filterStatus)
->setButtons(
array(
'all' => pht('All'),
'open' => pht('Open'),
+ 'concern' => pht('Concern Raised'),
)));
}
$form->appendChild(
id(new AphrontFormSubmitControl())
->setValue(pht('Filter Audits')));
$view = new AphrontListFilterView();
$view->appendChild($form);
return $view;
}
private function loadHandle() {
$request = $this->getRequest();
$default = null;
switch ($this->filter) {
case 'user':
case 'active':
case 'author':
$default = $request->getUser()->getPHID();
if ($this->name) {
$user = id(new PhabricatorUser())->loadOneWhere(
'username = %s',
$this->name);
if ($user) {
$default = $user->getPHID();
}
}
break;
}
$phid = $request->getStr('phid', $default);
if (!$phid) {
return null;
}
$phids = array($phid);
$handles = $this->loadViewerHandles($phids);
$handle = $handles[$phid];
$this->validateHandle($handle);
return $handle;
}
private function validateHandle(PhabricatorObjectHandle $handle) {
switch ($this->filter) {
case 'active':
case 'user':
case 'author':
if ($handle->getType() !== PhabricatorPHIDConstants::PHID_TYPE_USER) {
throw new Exception("PHID must be a user PHID!");
}
break;
case 'package':
case 'packagecommits':
if ($handle->getType() !== PhabricatorPHIDConstants::PHID_TYPE_OPKG) {
throw new Exception("PHID must be a package PHID!");
}
break;
case 'project':
if ($handle->getType() !== PhabricatorPHIDConstants::PHID_TYPE_PROJ) {
throw new Exception("PHID must be a project PHID!");
}
break;
case 'repository':
if ($handle->getType() !== PhabricatorPHIDConstants::PHID_TYPE_REPO) {
throw new Exception("PHID must be a repository PHID!");
}
break;
case 'audits':
case 'commits':
break;
default:
throw new Exception("Unknown filter '{$this->filter}'!");
}
}
private function buildViews(PhabricatorObjectHandle $handle = null) {
$views = array();
switch ($this->filter) {
case 'active':
$views[] = $this->buildAuditView($handle);
$views[] = $this->buildCommitView($handle);
break;
case 'audits':
case 'user':
case 'package':
case 'project':
case 'repository':
$views[] = $this->buildAuditView($handle);
break;
case 'commits':
case 'packagecommits':
case 'author':
$views[] = $this->buildCommitView($handle);
break;
}
return $views;
}
private function buildAuditView(PhabricatorObjectHandle $handle = null) {
$request = $this->getRequest();
$query = new PhabricatorAuditQuery();
$use_pager = ($this->filter != 'active');
if ($use_pager) {
$pager = new AphrontPagerView();
$pager->setURI($request->getRequestURI(), 'offset');
$pager->setOffset($request->getInt('offset'));
$query->setOffset($pager->getOffset());
$query->setLimit($pager->getPageSize() + 1);
}
$awaiting = null;
$phids = null;
$repository_phids = null;
switch ($this->filter) {
case 'user':
case 'active':
$obj = id(new PhabricatorUser())->loadOneWhere(
'phid = %s',
$handle->getPHID());
if (!$obj) {
throw new Exception("Invalid user!");
}
$phids = PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($obj);
$awaiting = $obj;
break;
case 'project':
case 'package':
$phids = array($handle->getPHID());
break;
case 'repository':
$repository_phids = array($handle->getPHID());
break;
case 'audits';
break;
default:
throw new Exception("Unknown filter!");
}
if ($phids) {
$query->withAuditorPHIDs($phids);
}
if ($repository_phids) {
$query->withRepositoryPHIDs($repository_phids);
}
if ($awaiting) {
$query->withAwaitingUser($awaiting);
}
switch ($this->filter) {
- case 'audits':
- case 'user':
- case 'project':
- case 'package':
- case 'repository':
+ case 'active':
+ $query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
+ break;
+ default:
switch ($this->filterStatus) {
case 'open':
$query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
break;
+ case 'concern':
+ $query->withStatus(PhabricatorAuditQuery::STATUS_CONCERN);
+ break;
}
break;
- case 'active':
- $query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
- break;
}
if ($handle) {
$handle_name = $handle->getFullName();
} else {
$handle_name = null;
}
switch ($this->filter) {
case 'active':
$header = pht('Required Audits');
$nodata = pht('No commits require your audit.');
break;
case 'user':
$header = pht("Audits for %s", $handle_name);
$nodata = pht("No matching audits by %s.", $handle_name);
break;
case 'audits':
$header = pht('Audits');
$nodata = pht('No matching audits.');
break;
case 'project':
$header = pht("Audits in Project %s", $handle_name);
$nodata = pht("No matching audits in project %s.", $handle_name);
break;
case 'package':
$header = pht("Audits for Package %s", $handle_name);
$nodata = pht("No matching audits in package %s.", $handle_name);
break;
case 'repository':
$header = pht("Audits in Repository %s", $handle_name);
$nodata = pht("No matching audits in repository %s.", $handle_name);
break;
}
$query->needCommitData(true);
$audits = $query->execute();
if ($use_pager) {
$audits = $pager->sliceResults($audits);
}
$view = new PhabricatorAuditListView();
$view->setAudits($audits);
$view->setCommits($query->getCommits());
$view->setUser($request->getUser());
$view->setNoDataString($nodata);
$phids = $view->getRequiredHandlePHIDs();
$handles = $this->loadViewerHandles($phids);
$view->setHandles($handles);
$panel = new AphrontPanelView();
$panel->setHeader($header);
$panel->appendChild($view);
$panel->setNoBackground();
if ($use_pager) {
$panel->appendChild($pager);
}
return $panel;
}
private function buildCommitView(PhabricatorObjectHandle $handle = null) {
$request = $this->getRequest();
$query = new PhabricatorAuditCommitQuery();
$query->needCommitData(true);
$query->needAudits(true);
$use_pager = ($this->filter != 'active');
if ($use_pager) {
$pager = new AphrontPagerView();
$pager->setURI($request->getRequestURI(), 'offset');
$pager->setOffset($request->getInt('offset'));
$query->setOffset($pager->getOffset());
$query->setLimit($pager->getPageSize() + 1);
}
switch ($this->filter) {
case 'active':
case 'author':
$query->withAuthorPHIDs(array($handle->getPHID()));
break;
case 'packagecommits':
$query->withPackagePHIDs(array($handle->getPHID()));
break;
}
switch ($this->filter) {
case 'active':
- $query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
+ $query->withStatus(PhabricatorAuditCommitQuery::STATUS_OPEN);
break;
- case 'author':
- case 'packagecommits':
+ default:
switch ($this->filterStatus) {
case 'open':
- $query->withStatus(PhabricatorAuditQuery::STATUS_OPEN);
+ $query->withStatus(PhabricatorAuditCommitQuery::STATUS_OPEN);
+ break;
+ case 'concern':
+ $query->withStatus(PhabricatorAuditCommitQuery::STATUS_CONCERN);
break;
}
break;
}
if ($handle) {
$handle_name = $handle->getName();
} else {
$handle_name = null;
}
switch ($this->filter) {
case 'active':
$header = pht('Problem Commits');
$nodata = pht('None of your commits have open concerns.');
break;
case 'author':
$header = pht("Commits by %s", $handle_name);
$nodata = pht("No matching commits by %s.", $handle_name);
break;
case 'commits':
$header = pht("Commits");
$nodata = pht("No matching commits.");
break;
case 'packagecommits':
$header = pht("Commits in Package %s", $handle_name);
$nodata = pht("No matching commits in package %s.", $handle_name);
break;
}
$commits = $query->execute();
if ($use_pager) {
$commits = $pager->sliceResults($commits);
}
$view = new PhabricatorAuditCommitListView();
$view->setUser($request->getUser());
$view->setCommits($commits);
$view->setNoDataString($nodata);
$phids = $view->getRequiredHandlePHIDs();
$handles = $this->loadViewerHandles($phids);
$view->setHandles($handles);
$panel = new AphrontPanelView();
$panel->setHeader($header);
$panel->appendChild($view);
$panel->setNoBackground();
if ($use_pager) {
$panel->appendChild($pager);
}
return $panel;
}
}
diff --git a/src/applications/audit/query/PhabricatorAuditCommitQuery.php b/src/applications/audit/query/PhabricatorAuditCommitQuery.php
index 4be00e0303..ef50d4aa01 100644
--- a/src/applications/audit/query/PhabricatorAuditCommitQuery.php
+++ b/src/applications/audit/query/PhabricatorAuditCommitQuery.php
@@ -1,213 +1,220 @@
<?php
final class PhabricatorAuditCommitQuery {
private $offset;
private $limit;
private $commitPHIDs;
private $authorPHIDs;
private $packagePHIDs;
private $identifiers = array();
private $needCommitData;
private $needAudits;
private $status = 'status-any';
const STATUS_ANY = 'status-any';
const STATUS_OPEN = 'status-open';
+ const STATUS_CONCERN = 'status-concern';
public function withAuthorPHIDs(array $author_phids) {
$this->authorPHIDs = $author_phids;
return $this;
}
public function withPackagePHIDs(array $phids) {
$this->packagePHIDs = $phids;
return $this;
}
public function withCommitPHIDs(array $phids) {
$this->commitPHIDs = $phids;
return $this;
}
public function withStatus($status) {
$this->status = $status;
return $this;
}
public function withIdentifiers($repository_id, array $identifiers) {
$this->identifiers[] = array($repository_id, $identifiers);
return $this;
}
public function needCommitData($need) {
$this->needCommitData = $need;
return $this;
}
public function needAudits($need) {
$this->needAudits = $need;
return $this;
}
public function setOffset($offset) {
$this->offset = $offset;
return $this;
}
public function setLimit($limit) {
$this->limit = $limit;
return $this;
}
public function execute() {
$table = new PhabricatorRepositoryCommit();
$conn_r = $table->establishConnection('r');
$join = $this->buildJoinClause($conn_r);
$where = $this->buildWhereClause($conn_r);
$order = $this->buildOrderClause($conn_r);
$limit = $this->buildLimitClause($conn_r);
$data = queryfx_all(
$conn_r,
'SELECT c.* FROM %T c %Q %Q %Q %Q',
$table->getTableName(),
$join,
$where,
$order,
$limit);
$commits = $table->loadAllFromArray($data);
if ($this->needCommitData && $commits) {
$data = id(new PhabricatorRepositoryCommitData())->loadAllWhere(
'commitID in (%Ld)',
mpull($commits, 'getID'));
$data = mpull($data, null, 'getCommitID');
foreach ($commits as $commit) {
if (idx($data, $commit->getID())) {
$commit->attachCommitData($data[$commit->getID()]);
} else {
$commit->attachCommitData(new PhabricatorRepositoryCommitData());
}
}
}
if ($this->needAudits && $commits) {
$audits = id(new PhabricatorAuditComment())->loadAllWhere(
'targetPHID in (%Ls)',
mpull($commits, 'getPHID'));
$audits = mgroup($audits, 'getTargetPHID');
foreach ($commits as $commit) {
$commit->attachAudits(idx($audits, $commit->getPHID(), array()));
}
}
return $commits;
}
private function buildOrderClause($conn_r) {
return 'ORDER BY c.epoch DESC';
}
private function buildJoinClause($conn_r) {
$join = array();
if ($this->packagePHIDs) {
$join[] = qsprintf(
$conn_r,
'JOIN %T req ON c.phid = req.commitPHID',
id(new PhabricatorRepositoryAuditRequest())->getTableName());
}
if ($join) {
$join = implode(' ', $join);
} else {
$join = '';
}
return $join;
}
private function buildWhereClause($conn_r) {
$where = array();
if ($this->commitPHIDs) {
$where[] = qsprintf(
$conn_r,
'c.phid IN (%Ls)',
$this->commitPHIDs);
}
if ($this->authorPHIDs) {
$where[] = qsprintf(
$conn_r,
'c.authorPHID IN (%Ls)',
$this->authorPHIDs);
}
if ($this->packagePHIDs) {
$where[] = qsprintf(
$conn_r,
'req.auditorPHID in (%Ls)',
$this->packagePHIDs);
}
if ($this->identifiers) {
$clauses = array();
foreach ($this->identifiers as $spec) {
list($repository_id, $identifiers) = $spec;
if ($identifiers) {
$clauses[] = qsprintf(
$conn_r,
'c.repositoryID = %d AND c.commitIdentifier IN (%Ls)',
$repository_id,
$identifiers);
}
}
if ($clauses) {
$where[] = '('.implode(') OR (', $clauses).')';
}
}
$status = $this->status;
switch ($status) {
- case self::STATUS_OPEN:
+ case self::STATUS_CONCERN:
$where[] = qsprintf(
$conn_r,
'c.auditStatus = %s',
PhabricatorAuditCommitStatusConstants::CONCERN_RAISED);
break;
+ case self::STATUS_OPEN:
+ $where[] = qsprintf(
+ $conn_r,
+ 'c.auditStatus IN (%Ls)',
+ PhabricatorAuditCommitStatusConstants::getOpenStatusConstants());
+ break;
case self::STATUS_ANY:
break;
default:
throw new Exception("Unknown status '{$status}'!");
}
if ($where) {
$where = 'WHERE ('.implode(') AND (', $where).')';
} else {
$where = '';
}
return $where;
}
private function buildLimitClause($conn_r) {
if ($this->limit && $this->offset) {
return qsprintf($conn_r, 'LIMIT %d, %d', $this->offset, $this->limit);
} else if ($this->limit) {
return qsprintf($conn_r, 'LIMIT %d', $this->limit);
} else if ($this->offset) {
return qsprintf($conn_r, 'LIMIT %d, %d', $this->offset, PHP_INT_MAX);
} else {
return '';
}
}
}
diff --git a/src/applications/audit/query/PhabricatorAuditQuery.php b/src/applications/audit/query/PhabricatorAuditQuery.php
index a556bbe70a..028424975c 100644
--- a/src/applications/audit/query/PhabricatorAuditQuery.php
+++ b/src/applications/audit/query/PhabricatorAuditQuery.php
@@ -1,236 +1,243 @@
<?php
final class PhabricatorAuditQuery {
private $offset;
private $limit;
private $auditorPHIDs;
private $commitPHIDs;
private $repositoryPHIDs;
private $needCommits;
private $needCommitData;
private $awaitingUser;
private $status = 'status-any';
const STATUS_ANY = 'status-any';
const STATUS_OPEN = 'status-open';
+ const STATUS_CONCERN = 'status-concern';
private $commits;
public function withCommitPHIDs(array $commit_phids) {
$this->commitPHIDs = $commit_phids;
return $this;
}
public function withAuditorPHIDs(array $auditor_phids) {
$this->auditorPHIDs = $auditor_phids;
return $this;
}
public function withRepositoryPHIDs(array $repository_phids) {
$this->repositoryPHIDs = $repository_phids;
return $this;
}
public function withAwaitingUser(PhabricatorUser $user) {
$this->awaitingUser = $user;
return $this;
}
public function withStatus($status) {
$this->status = $status;
return $this;
}
public function setOffset($offset) {
$this->offset = $offset;
return $this;
}
public function setLimit($limit) {
$this->limit = $limit;
return $this;
}
public function needCommits($need) {
$this->needCommits = $need;
return $this;
}
public function needCommitData($need) {
$this->needCommitData = $need;
return $this;
}
public function execute() {
$table = new PhabricatorRepositoryAuditRequest();
$conn_r = $table->establishConnection('r');
$joins = $this->buildJoinClause($conn_r);
$where = $this->buildWhereClause($conn_r);
$order = $this->buildOrderClause($conn_r);
$limit = $this->buildLimitClause($conn_r);
$data = queryfx_all(
$conn_r,
'SELECT req.* FROM %T req %Q %Q %Q %Q',
$table->getTableName(),
$joins,
$where,
$order,
$limit);
$audits = $table->loadAllFromArray($data);
if ($this->needCommits || $this->needCommitData) {
$phids = mpull($audits, 'getCommitPHID', 'getCommitPHID');
if ($phids) {
$cquery = new PhabricatorAuditCommitQuery();
$cquery->needCommitData($this->needCommitData);
$cquery->withCommitPHIDs(array_keys($phids));
$commits = $cquery->execute();
} else {
$commits = array();
}
$this->commits = $commits;
}
return $audits;
}
public function getCommits() {
if ($this->commits === null) {
throw new Exception(
"Call needCommits() or needCommitData() and then execute() the query ".
"before calling getCommits()!");
}
return $this->commits;
}
private function buildJoinClause($conn_r) {
$joins = array();
if ($this->awaitingUser) {
// Join the request table on the awaiting user's requests, so we can
// filter out package and project requests which the user has resigned
// from.
$joins[] = qsprintf(
$conn_r,
'LEFT JOIN %T awaiting ON req.commitPHID = awaiting.commitPHID AND
awaiting.auditorPHID = %s',
id(new PhabricatorRepositoryAuditRequest())->getTableName(),
$this->awaitingUser->getPHID());
}
if ($this->awaitingUser || $this->repositoryPHIDs) {
// Join the commit table so we can get the commit author or repository id
// into the result row and filter by it later.
$joins[] = qsprintf(
$conn_r,
'JOIN %T commit ON req.commitPHID = commit.phid',
id(new PhabricatorRepositoryCommit())->getTableName());
}
if ($this->repositoryPHIDs) {
// Join in the repository table so we can filter by repository PHID
$joins[] = qsprintf(
$conn_r,
'JOIN %T repository ON repository.id = commit.repositoryID',
id(new PhabricatorRepository())->getTableName());
}
if ($joins) {
return implode(' ', $joins);
} else {
return '';
}
}
private function buildWhereClause($conn_r) {
$where = array();
if ($this->commitPHIDs) {
$where[] = qsprintf(
$conn_r,
'req.commitPHID IN (%Ls)',
$this->commitPHIDs);
}
if ($this->auditorPHIDs) {
$where[] = qsprintf(
$conn_r,
'req.auditorPHID IN (%Ls)',
$this->auditorPHIDs);
}
if ($this->awaitingUser) {
// Exclude package and project audits associated with commits where
// the user is the author.
$where[] = qsprintf(
$conn_r,
'(commit.authorPHID IS NULL OR commit.authorPHID != %s)
OR (req.auditorPHID = %s)',
$this->awaitingUser->getPHID(),
$this->awaitingUser->getPHID());
}
if ($this->repositoryPHIDs) {
// Filter only for a single repository
$where[] = qsprintf(
$conn_r,
'repository.phid IN (%Ls)',
$this->repositoryPHIDs);
}
$status = $this->status;
switch ($status) {
+ case self::STATUS_CONCERN:
+ $where[] = qsprintf(
+ $conn_r,
+ 'req.auditStatus = %s',
+ PhabricatorAuditStatusConstants::CONCERNED);
+ break;
case self::STATUS_OPEN:
$where[] = qsprintf(
$conn_r,
'req.auditStatus in (%Ls)',
PhabricatorAuditStatusConstants::getOpenStatusConstants());
if ($this->awaitingUser) {
$where[] = qsprintf(
$conn_r,
'awaiting.auditStatus IS NULL OR awaiting.auditStatus != %s',
PhabricatorAuditStatusConstants::RESIGNED);
}
break;
case self::STATUS_ANY:
break;
default:
throw new Exception("Unknown status '{$status}'!");
}
if ($where) {
$where = 'WHERE ('.implode(') AND (', $where).')';
} else {
$where = '';
}
return $where;
}
private function buildLimitClause($conn_r) {
if ($this->limit && $this->offset) {
return qsprintf($conn_r, 'LIMIT %d, %d', $this->offset, $this->limit);
} else if ($this->limit) {
return qsprintf($conn_r, 'LIMIT %d', $this->limit);
} else if ($this->offset) {
return qsprintf($conn_r, 'LIMIT %d, %d', $this->offset, PHP_INT_MAX);
} else {
return '';
}
}
private function buildOrderClause($conn_r) {
return 'ORDER BY req.id DESC';
}
}

File Metadata

Mime Type
text/x-diff
Expires
Wed, Jul 2, 1:54 AM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
164610
Default Alt Text
(28 KB)

Event Timeline