Implement ApplicationSearch in Files
Summary: Ref T2625. Ref T1163. A couple of small generalization nudges, but this is almost entirely straightforward. Test Plan: Executed various File queries. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T1163, T2625 Differential Revision: https://secure.phabricator.com/D6091
This commit is contained in:
@@ -8,6 +8,8 @@ final class PhabricatorFileQuery
|
||||
private $authorPHIDs;
|
||||
private $explicitUploads;
|
||||
private $transforms;
|
||||
private $dateCreatedAfter;
|
||||
private $dateCreatedBefore;
|
||||
|
||||
public function withIDs(array $ids) {
|
||||
$this->ids = $ids;
|
||||
@@ -24,6 +26,16 @@ final class PhabricatorFileQuery
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withDateCreatedBefore($date_created_before) {
|
||||
$this->dateCreatedBefore = $date_created_before;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function withDateCreatedAfter($date_created_after) {
|
||||
$this->dateCreatedAfter = $date_created_after;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Select files which are transformations of some other file. For example,
|
||||
* you can use this query to find previously generated thumbnails of an image
|
||||
@@ -156,6 +168,20 @@ final class PhabricatorFileQuery
|
||||
$where[] = qsprintf($conn_r, '(%Q)', implode(') OR (', $clauses));
|
||||
}
|
||||
|
||||
if ($this->dateCreatedAfter) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'f.dateCreated >= %d',
|
||||
$this->dateCreatedAfter);
|
||||
}
|
||||
|
||||
if ($this->dateCreatedBefore) {
|
||||
$where[] = qsprintf(
|
||||
$conn_r,
|
||||
'f.dateCreated <= %d',
|
||||
$this->dateCreatedBefore);
|
||||
}
|
||||
|
||||
return $this->formatWhereClause($where);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user