Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15352527
D13384.id32415.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D13384.id32415.diff
View Options
diff --git a/src/applications/passphrase/query/PassphraseCredentialQuery.php b/src/applications/passphrase/query/PassphraseCredentialQuery.php
--- a/src/applications/passphrase/query/PassphraseCredentialQuery.php
+++ b/src/applications/passphrase/query/PassphraseCredentialQuery.php
@@ -53,19 +53,12 @@
return $this;
}
+ public function newResultObject() {
+ return new PassphraseCredential();
+ }
+
protected function loadPage() {
- $table = new PassphraseCredential();
- $conn_r = $table->establishConnection('r');
-
- $rows = queryfx_all(
- $conn_r,
- 'SELECT * FROM %T %Q %Q %Q',
- $table->getTableName(),
- $this->buildWhereClause($conn_r),
- $this->buildOrderClause($conn_r),
- $this->buildLimitClause($conn_r));
-
- return $table->loadAllFromArray($rows);
+ return $this->loadStandardPage($this->newResultObject());
}
protected function willFilterPage(array $page) {
@@ -99,61 +92,59 @@
return $page;
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
- $where = array();
-
- $where[] = $this->buildPagingClause($conn_r);
+ protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
+ $where = parent::buildWhereClauseParts($conn);
- if ($this->ids) {
+ if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
- if ($this->phids) {
+ if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
- if ($this->credentialTypes) {
+ if ($this->credentialTypes !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'credentialType in (%Ls)',
$this->credentialTypes);
}
- if ($this->providesTypes) {
+ if ($this->providesTypes !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'providesType IN (%Ls)',
$this->providesTypes);
}
if ($this->isDestroyed !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'isDestroyed = %d',
(int)$this->isDestroyed);
}
if ($this->allowConduit !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'allowConduit = %d',
(int)$this->allowConduit);
}
if (strlen($this->nameContains)) {
$where[] = qsprintf(
- $conn_r,
- 'name LIKE %~',
- $this->nameContains);
+ $conn,
+ 'LOWER(name) LIKE %~',
+ phutil_utf8_strtolower($this->nameContains));
}
- return $this->formatWhereClause($where);
+ return $where;
}
public function getQueryApplicationClass() {
diff --git a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
--- a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
+++ b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
@@ -11,58 +11,39 @@
return 'PhabricatorPassphraseApplication';
}
- public function buildSavedQueryFromRequest(AphrontRequest $request) {
- $saved = new PhabricatorSavedQuery();
-
- $saved->setParameter(
- 'isDestroyed',
- $this->readBoolFromRequest($request, 'isDestroyed'));
- $saved->setParameter('name', $request->getStr('name'));
+ public function newQuery() {
+ return new PassphraseCredentialQuery();
+ }
- return $saved;
+ protected function buildCustomSearchFields() {
+ return array(
+ id(new PhabricatorSearchThreeStateField())
+ ->setLabel(pht('Status'))
+ ->setKey('isDestroyed')
+ ->setOptions(
+ pht('Show All'),
+ pht('Show Only Destroyed Credentials'),
+ pht('Show Only Active Credentials')),
+ id(new PhabricatorSearchTextField())
+ ->setLabel(pht('Name Contains'))
+ ->setKey('name'),
+ );
}
- public function buildQueryFromSavedQuery(PhabricatorSavedQuery $saved) {
- $query = id(new PassphraseCredentialQuery());
+ protected function buildQueryFromParameters(array $map) {
+ $query = $this->newQuery();
- $destroyed = $saved->getParameter('isDestroyed');
- if ($destroyed !== null) {
- $query->withIsDestroyed($destroyed);
+ if ($map['isDestroyed'] !== null) {
+ $query->withIsDestroyed($map['isDestroyed']);
}
- $name = $saved->getParameter('name');
- if (strlen($name)) {
- $query->withNameContains($name);
+ if (strlen($map['name'])) {
+ $query->withNameContains($map['name']);
}
return $query;
}
- public function buildSearchForm(
- AphrontFormView $form,
- PhabricatorSavedQuery $saved_query) {
-
- $name = $saved_query->getParameter('name');
-
- $form
- ->appendChild(
- id(new AphrontFormSelectControl())
- ->setName('isDestroyed')
- ->setLabel(pht('Status'))
- ->setValue($this->getBoolFromQuery($saved_query, 'isDestroyed'))
- ->setOptions(
- array(
- '' => pht('Show All Credentials'),
- 'false' => pht('Show Only Active Credentials'),
- 'true' => pht('Show Only Destroyed Credentials'),
- )))
- ->appendChild(
- id(new AphrontFormTextControl())
- ->setName('name')
- ->setLabel(pht('Name Contains'))
- ->setValue($name));
- }
-
protected function getURI($path) {
return '/passphrase/'.$path;
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Mar 11, 4:53 PM (1 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7229962
Default Alt Text
D13384.id32415.diff (5 KB)
Attached To
Mode
D13384: Move Passphrase to SearchField
Attached
Detach File
Event Timeline
Log In to Comment