diff --git a/resources/sql/autopatches/20140317.mupdatedkey.sql b/resources/sql/autopatches/20140317.mupdatedkey.sql new file mode 100644 --- /dev/null +++ b/resources/sql/autopatches/20140317.mupdatedkey.sql @@ -0,0 +1,2 @@ +ALTER TABLE {$NAMESPACE}_maniphest.maniphest_task + ADD KEY `key_dateModified` (dateModified); diff --git a/src/applications/maniphest/query/ManiphestTaskQuery.php b/src/applications/maniphest/query/ManiphestTaskQuery.php --- a/src/applications/maniphest/query/ManiphestTaskQuery.php +++ b/src/applications/maniphest/query/ManiphestTaskQuery.php @@ -22,6 +22,8 @@ private $includeNoProject = null; private $dateCreatedAfter; private $dateCreatedBefore; + private $dateModifiedAfter; + private $dateModifiedBefore; private $fullTextSearch = ''; @@ -153,6 +155,16 @@ return $this; } + public function withDateModifiedBefore($date_modified_before) { + $this->dateModifiedBefore = $date_modified_before; + return $this; + } + + public function withDateModifiedAfter($date_modified_after) { + $this->dateModifiedAfter = $date_modified_after; + return $this; + } + public function loadPage() { // TODO: (T603) It is possible for a user to find the PHID of a project @@ -193,6 +205,20 @@ $this->dateCreatedBefore); } + if ($this->dateModifiedAfter) { + $where[] = qsprintf( + $conn, + 'dateModified >= %d', + $this->dateModifiedAfter); + } + + if ($this->dateModifiedBefore) { + $where[] = qsprintf( + $conn, + 'dateModified <= %d', + $this->dateModifiedBefore); + } + $where[] = $this->buildPagingClause($conn); $where = $this->formatWhereClause($where); diff --git a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php --- a/src/applications/maniphest/query/ManiphestTaskSearchEngine.php +++ b/src/applications/maniphest/query/ManiphestTaskSearchEngine.php @@ -64,6 +64,8 @@ $saved->setParameter('createdStart', $request->getStr('createdStart')); $saved->setParameter('createdEnd', $request->getStr('createdEnd')); + $saved->setParameter('modifiedStart', $request->getStr('modifiedStart')); + $saved->setParameter('modifiedEnd', $request->getStr('modifiedEnd')); $limit = $request->getInt('limit'); if ($limit > 0) { @@ -170,6 +172,17 @@ $query->withDateCreatedBefore($end); } + $mod_start = $this->parseDateTime($saved->getParameter('modifiedStart')); + $mod_end = $this->parseDateTime($saved->getParameter('modifiedEnd')); + + if ($mod_start) { + $query->withDateModifiedAfter($mod_start); + } + + if ($mod_end) { + $query->withDateModifiedBefore($mod_end); + } + $this->applyCustomFieldsToQuery($query, $saved); return $query; @@ -344,6 +357,14 @@ 'createdEnd', pht('Created Before')); + $this->buildDateRange( + $form, + $saved, + 'modifiedStart', + pht('Updated After'), + 'modifiedEnd', + pht('Updated Before')); + $form ->appendChild( id(new AphrontFormTextControl())