Page MenuHomePhabricator

D14411.id34816.diff
No OneTemporary

D14411.id34816.diff

diff --git a/src/applications/files/query/PhabricatorFileQuery.php b/src/applications/files/query/PhabricatorFileQuery.php
--- a/src/applications/files/query/PhabricatorFileQuery.php
+++ b/src/applications/files/query/PhabricatorFileQuery.php
@@ -14,6 +14,7 @@
private $minLength;
private $maxLength;
private $names;
+ private $namesLike;
private $isPartial;
public function withIDs(array $ids) {
@@ -107,6 +108,11 @@
return $this;
}
+ public function withNamesLike($names_like) {
+ $this->namesLike = $names_like;
+ return $this;
+ }
+
public function withIsPartial($partial) {
$this->isPartial = $partial;
return $this;
@@ -323,6 +329,13 @@
$this->names);
}
+ if ($this->namesLike !== null) {
+ $where[] = qsprintf(
+ $conn,
+ 'name like %s',
+ $this->namesLike);
+ }
+
if ($this->isPartial !== null) {
$where[] = qsprintf(
$conn,
diff --git a/src/applications/files/query/PhabricatorFileSearchEngine.php b/src/applications/files/query/PhabricatorFileSearchEngine.php
--- a/src/applications/files/query/PhabricatorFileSearchEngine.php
+++ b/src/applications/files/query/PhabricatorFileSearchEngine.php
@@ -17,6 +17,9 @@
protected function buildCustomSearchFields() {
return array(
+ id(new PhabricatorSearchTextField())
+ ->setKey('name')
+ ->setLabel(pht('Name')),
id(new PhabricatorUsersSearchField())
->setKey('authorPHIDs')
->setAliases(array('author', 'authors'))
@@ -48,6 +51,10 @@
protected function buildQueryFromParameters(array $map) {
$query = $this->newQuery();
+ if ($map['name']) {
+ $query->withNamesLike('%'.$map['name'].'%');
+ }
+
if ($map['authorPHIDs']) {
$query->withAuthorPHIDs($map['authorPHIDs']);
}

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 20, 12:23 AM (6 d, 4 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6734438
Default Alt Text
D14411.id34816.diff (1 KB)

Event Timeline