protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->objectPHIDs !== null) {
         $where[] = qsprintf($conn, 'objectPHID IN (%Ls)', $this->objectPHIDs);
     }
     if ($this->keys !== null) {
         $sql = array();
         foreach ($this->keys as $key) {
             $sql[] = qsprintf($conn, '(keyType = %s AND keyIndex = %s)', $key->getType(), $key->getHash());
         }
         $where[] = implode(' OR ', $sql);
     }
     if ($this->isActive !== null) {
         if ($this->isActive) {
             $where[] = qsprintf($conn, 'isActive = %d', 1);
         } else {
             $where[] = qsprintf($conn, 'isActive IS NULL');
         }
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'p.phid IN (%Ls)', $this->phids);
     }
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'p.id IN (%Ld)', $this->ids);
     }
     if ($this->repositoryPHIDs !== null) {
         $where[] = qsprintf($conn, 'rpath.repositoryPHID IN (%Ls)', $this->repositoryPHIDs);
     }
     if ($this->ownerPHIDs !== null) {
         $base_phids = $this->ownerPHIDs;
         $projects = id(new PhabricatorProjectQuery())->setViewer($this->getViewer())->withMemberPHIDs($base_phids)->execute();
         $project_phids = mpull($projects, 'getPHID');
         $all_phids = array_merge($base_phids, $project_phids);
         $where[] = qsprintf($conn, 'o.userPHID IN (%Ls)', $all_phids);
     }
     if (strlen($this->namePrefix)) {
         // NOTE: This is a hacky mess, but this column is currently case
         // sensitive and unique.
         $where[] = qsprintf($conn, 'LOWER(p.name) LIKE %>', phutil_utf8_strtolower($this->namePrefix));
     }
     return $where;
 }
Esempio n. 3
0
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids) {
         $where[] = qsprintf($conn, 'p.id IN (%Ld)', $this->ids);
     }
     if ($this->phids) {
         $where[] = qsprintf($conn, 'p.phid IN (%Ls)', $this->phids);
     }
     if ($this->bloggerPHIDs) {
         $where[] = qsprintf($conn, 'p.bloggerPHID IN (%Ls)', $this->bloggerPHIDs);
     }
     if ($this->phameTitles) {
         $where[] = qsprintf($conn, 'p.phameTitle IN (%Ls)', $this->phameTitles);
     }
     if ($this->visibility !== null) {
         $where[] = qsprintf($conn, 'p.visibility = %d', $this->visibility);
     }
     if ($this->publishedAfter !== null) {
         $where[] = qsprintf($conn, 'p.datePublished > %d', $this->publishedAfter);
     }
     if ($this->blogPHIDs) {
         $where[] = qsprintf($conn, 'p.blogPHID in (%Ls)', $this->blogPHIDs);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->tokenResources !== null) {
         $where[] = qsprintf($conn, 'tokenResource IN (%Ls)', $this->tokenResources);
     }
     if ($this->tokenTypes !== null) {
         $where[] = qsprintf($conn, 'tokenType IN (%Ls)', $this->tokenTypes);
     }
     if ($this->expired !== null) {
         if ($this->expired) {
             $where[] = qsprintf($conn, 'tokenExpires <= %d', time());
         } else {
             $where[] = qsprintf($conn, 'tokenExpires > %d', time());
         }
     }
     if ($this->tokenCodes !== null) {
         $where[] = qsprintf($conn, 'tokenCode IN (%Ls)', $this->tokenCodes);
     }
     if ($this->userPHIDs !== null) {
         $where[] = qsprintf($conn, 'userPHID IN (%Ls)', $this->userPHIDs);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'mail.id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'mail.phid IN (%Ls)', $this->phids);
     }
     if ($this->actorPHIDs !== null) {
         $where[] = qsprintf($conn, 'mail.actorPHID IN (%Ls)', $this->actorPHIDs);
     }
     if ($this->recipientPHIDs !== null) {
         $where[] = qsprintf($conn, 'recipient.dst IN (%Ls)', $this->recipientPHIDs);
     }
     if ($this->actorPHIDs === null && $this->recipientPHIDs === null) {
         $viewer = $this->getViewer();
         if (!$viewer->isOmnipotent()) {
             $where[] = qsprintf($conn, 'edge.dst = %s OR actorPHID = %s', $viewer->getPHID(), $viewer->getPHID());
         }
     }
     if ($this->createdMin !== null) {
         $where[] = qsprintf($conn, 'mail.dateCreated >= %d', $this->createdMin);
     }
     if ($this->createdMax !== null) {
         $where[] = qsprintf($conn, 'mail.dateCreated <= %d', $this->createdMax);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->repositoryPHIDs !== null) {
         $where[] = qsprintf($conn, 'repositoryPHID IN (%Ls)', $this->repositoryPHIDs);
     }
     if ($this->refTypes !== null) {
         $where[] = qsprintf($conn, 'refType IN (%Ls)', $this->refTypes);
     }
     if ($this->refNames !== null) {
         $name_hashes = array();
         foreach ($this->refNames as $name) {
             $name_hashes[] = PhabricatorHash::digestForIndex($name);
         }
         $where[] = qsprintf($conn, 'refNameHash IN (%Ls)', $name_hashes);
     }
     if (strlen($this->datasourceQuery)) {
         $where[] = qsprintf($conn, 'refNameRaw LIKE %>', $this->datasourceQuery);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'q.id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'q.phid IN (%Ls)', $this->phids);
     }
     if ($this->authorPHIDs !== null) {
         $where[] = qsprintf($conn, 'q.authorPHID IN (%Ls)', $this->authorPHIDs);
     }
     if ($this->status !== null) {
         switch ($this->status) {
             case self::STATUS_ANY:
                 break;
             case self::STATUS_OPEN:
                 $where[] = qsprintf($conn, 'q.status = %d', PonderQuestionStatus::STATUS_OPEN);
                 break;
             case self::STATUS_CLOSED:
                 $where[] = qsprintf($conn, 'q.status = %d', PonderQuestionStatus::STATUS_CLOSED);
                 break;
             default:
                 throw new Exception(pht("Unknown status query '%s'!", $this->status));
         }
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->callerPHIDs !== null) {
         $where[] = qsprintf($conn, 'callerPHID IN (%Ls)', $this->callerPHIDs);
     }
     if ($this->methods !== null) {
         $where[] = qsprintf($conn, 'method IN (%Ls)', $this->methods);
     }
     if ($this->methodStatuses !== null) {
         $statuses = array_fuse($this->methodStatuses);
         $methods = id(new PhabricatorConduitMethodQuery())->setViewer($this->getViewer())->execute();
         $method_names = array();
         foreach ($methods as $method) {
             $status = $method->getMethodStatus();
             if (isset($statuses[$status])) {
                 $method_names[] = $method->getAPIMethodName();
             }
         }
         if (!$method_names) {
             throw new PhabricatorEmptyQueryException();
         }
         $where[] = qsprintf($conn, 'method IN (%Ls)', $method_names);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->authorPHIDs !== null) {
         $where[] = qsprintf($conn, 'authorPHID IN (%Ls)', $this->authorPHIDs);
     }
     if ($this->objectPHIDs !== null) {
         $where[] = qsprintf($conn, 'objectPHID IN (%Ls)', $this->objectPHIDs);
     }
     if ($this->tokenPHIDs !== null) {
         $where[] = qsprintf($conn, 'tokenPHID IN (%Ls)', $this->tokenPHIDs);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->repositoryPHIDs !== null) {
         $where[] = qsprintf($conn, 'repositoryPHID IN (%Ls)', $this->repositoryPHIDs);
     }
     if ($this->oldCommitIdentifiers !== null) {
         $where[] = qsprintf($conn, 'oldCommitIdentifier IN (%Ls)', $this->oldCommitIdentifiers);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->badgePHIDs !== null) {
         $where[] = qsprintf($conn, 'badgePHID IN (%Ls)', $this->badgePHIDs);
     }
     if ($this->recipientPHIDs !== null) {
         $where[] = qsprintf($conn, 'recipientPHID IN (%Ls)', $this->recipientPHIDs);
     }
     if ($this->awarderPHIDs !== null) {
         $where[] = qsprintf($conn, 'awarderPHID IN (%Ls)', $this->awarderPHIDs);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->authorPHIDs !== null) {
         $where[] = qsprintf($conn, 'authorPHID in (%Ls)', $this->authorPHIDs);
     }
     if ($this->upcoming !== null) {
         $where[] = qsprintf($conn, 'epoch >= %d', PhabricatorTime::getNow());
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'import.id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'import.phid IN (%Ls)', $this->phids);
     }
     if ($this->authorPHIDs !== null) {
         $where[] = qsprintf($conn, 'import.authorPHID IN (%Ls)', $this->authorPHIDs);
     }
     if ($this->isDisabled !== null) {
         $where[] = qsprintf($conn, 'import.isDisabled = %d', (int) $this->isDisabled);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->buildTargetPHIDs !== null) {
         $where[] = qsprintf($conn, 'buildTargetPHID IN (%Ls)', $this->buildTargetPHIDs);
     }
     if ($this->artifactTypes !== null) {
         $where[] = qsprintf($conn, 'artifactType in (%Ls)', $this->artifactTypes);
     }
     if ($this->artifactIndexes !== null) {
         $where[] = qsprintf($conn, 'artifactIndex IN (%Ls)', $this->artifactIndexes);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->archived !== null) {
         $where[] = qsprintf($conn, 'isArchived = %d', (int) $this->archived);
     }
     if ($this->panelTypes !== null) {
         $where[] = qsprintf($conn, 'panelType IN (%Ls)', $this->panelTypes);
     }
     return $where;
 }
Esempio n. 17
0
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'mock.id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'mock.phid IN (%Ls)', $this->phids);
     }
     if ($this->authorPHIDs !== null) {
         $where[] = qsprintf($conn, 'mock.authorPHID in (%Ls)', $this->authorPHIDs);
     }
     if ($this->statuses !== null) {
         $where[] = qsprintf($conn, 'mock.status IN (%Ls)', $this->statuses);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'badges.id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'badges.phid IN (%Ls)', $this->phids);
     }
     if ($this->qualities !== null) {
         $where[] = qsprintf($conn, 'badges.quality IN (%Ls)', $this->qualities);
     }
     if ($this->statuses !== null) {
         $where[] = qsprintf($conn, 'badges.status IN (%Ls)', $this->statuses);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->names !== null) {
         $name_indexes = array();
         foreach ($this->names as $name) {
             $name_indexes[] = PhabricatorHash::digestForIndex($name);
         }
         $where[] = qsprintf($conn, 'nameIndex IN (%Ls)', $name_indexes);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->statuses !== null) {
         $where[] = qsprintf($conn, 'planStatus IN (%Ls)', $this->statuses);
     }
     if (strlen($this->datasourceQuery)) {
         $where[] = qsprintf($conn, 'name LIKE %>', $this->datasourceQuery);
     }
     if ($this->planAutoKeys !== null) {
         $where[] = qsprintf($conn, 'planAutoKey IN (%Ls)', $this->planAutoKeys);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'url.id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'url.phid IN (%Ls)', $this->phids);
     }
     if ($this->authorPHIDs !== null) {
         $where[] = qsprintf($conn, 'url.authorPHID IN (%Ls)', $this->authorPHIDs);
     }
     if ($this->names !== null) {
         $where[] = qsprintf($conn, 'url.name IN (%Ls)', $this->names);
     }
     if ($this->longURLs !== null) {
         $where[] = qsprintf($conn, 'url.longURL IN (%Ls)', $this->longURLs);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->addresses !== null) {
         $where[] = qsprintf($conn, 'appemail.address IN (%Ls)', $this->addresses);
     }
     if ($this->addressPrefix !== null) {
         $where[] = qsprintf($conn, 'appemail.address LIKE %>', $this->addressPrefix);
     }
     if ($this->applicationPHIDs !== null) {
         $where[] = qsprintf($conn, 'appemail.applicationPHID IN (%Ls)', $this->applicationPHIDs);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'appemail.phid IN (%Ls)', $this->phids);
     }
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'appemail.id IN (%Ld)', $this->ids);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->isDefaultNamespace !== null) {
         if ($this->isDefaultNamespace) {
             $where[] = qsprintf($conn, 'isDefaultNamespace = 1');
         } else {
             $where[] = qsprintf($conn, 'isDefaultNamespace IS NULL');
         }
     }
     if ($this->isArchived !== null) {
         $where[] = qsprintf($conn, 'isArchived = %d', (int) $this->isArchived);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->status != self::STATUS_ANY) {
         switch ($this->status) {
             case self::STATUS_OPEN:
             case self::STATUS_ACTIVE:
                 $filter = array(PhabricatorProjectStatus::STATUS_ACTIVE);
                 break;
             case self::STATUS_CLOSED:
             case self::STATUS_ARCHIVED:
                 $filter = array(PhabricatorProjectStatus::STATUS_ARCHIVED);
                 break;
             default:
                 throw new Exception(pht("Unknown project status '%s'!", $this->status));
         }
         $where[] = qsprintf($conn, 'status IN (%Ld)', $filter);
     }
     if ($this->statuses !== null) {
         $where[] = qsprintf($conn, 'status IN (%Ls)', $this->statuses);
     }
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->memberPHIDs !== null) {
         $where[] = qsprintf($conn, 'e.dst IN (%Ls)', $this->memberPHIDs);
     }
     if ($this->watcherPHIDs !== null) {
         $where[] = qsprintf($conn, 'w.dst IN (%Ls)', $this->watcherPHIDs);
     }
     if ($this->slugs !== null) {
         $where[] = qsprintf($conn, 'slug.slug IN (%Ls)', $this->allSlugs);
     }
     if ($this->names !== null) {
         $where[] = qsprintf($conn, 'name IN (%Ls)', $this->names);
     }
     if ($this->namePrefixes) {
         $parts = array();
         foreach ($this->namePrefixes as $name_prefix) {
             $parts[] = qsprintf($conn, 'name LIKE %>', $name_prefix);
         }
         $where[] = '(' . implode(' OR ', $parts) . ')';
     }
     if ($this->icons !== null) {
         $where[] = qsprintf($conn, 'icon IN (%Ls)', $this->icons);
     }
     if ($this->colors !== null) {
         $where[] = qsprintf($conn, 'color IN (%Ls)', $this->colors);
     }
     if ($this->parentPHIDs !== null) {
         $where[] = qsprintf($conn, 'parentProjectPHID IN (%Ls)', $this->parentPHIDs);
     }
     if ($this->ancestorPHIDs !== null) {
         $ancestor_paths = queryfx_all($conn, 'SELECT projectPath, projectDepth FROM %T WHERE phid IN (%Ls)', id(new PhabricatorProject())->getTableName(), $this->ancestorPHIDs);
         if (!$ancestor_paths) {
             throw new PhabricatorEmptyQueryException();
         }
         $sql = array();
         foreach ($ancestor_paths as $ancestor_path) {
             $sql[] = qsprintf($conn, '(projectPath LIKE %> AND projectDepth > %d)', $ancestor_path['projectPath'], $ancestor_path['projectDepth']);
         }
         $where[] = '(' . implode(' OR ', $sql) . ')';
         $where[] = qsprintf($conn, 'parentProjectPHID IS NOT NULL');
     }
     if ($this->isMilestone !== null) {
         if ($this->isMilestone) {
             $where[] = qsprintf($conn, 'milestoneNumber IS NOT NULL');
         } else {
             $where[] = qsprintf($conn, 'milestoneNumber IS NULL');
         }
     }
     if ($this->hasSubprojects !== null) {
         $where[] = qsprintf($conn, 'hasSubprojects = %d', (int) $this->hasSubprojects);
     }
     if ($this->minDepth !== null) {
         $where[] = qsprintf($conn, 'projectDepth >= %d', $this->minDepth);
     }
     if ($this->maxDepth !== null) {
         $where[] = qsprintf($conn, 'projectDepth <= %d', $this->maxDepth);
     }
     if ($this->minMilestoneNumber !== null) {
         $where[] = qsprintf($conn, 'milestoneNumber >= %d', $this->minMilestoneNumber);
     }
     if ($this->maxMilestoneNumber !== null) {
         $where[] = qsprintf($conn, 'milestoneNumber <= %d', $this->maxMilestoneNumber);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'p.phid IN (%Ls)', $this->phids);
     }
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'p.id IN (%Ld)', $this->ids);
     }
     if ($this->repositoryPHIDs !== null) {
         $where[] = qsprintf($conn, 'rpath.repositoryPHID IN (%Ls)', $this->repositoryPHIDs);
     }
     if ($this->authorityPHIDs !== null) {
         $authority_phids = $this->expandAuthority($this->authorityPHIDs);
         $where[] = qsprintf($conn, 'o.userPHID IN (%Ls)', $authority_phids);
     }
     if ($this->ownerPHIDs !== null) {
         $where[] = qsprintf($conn, 'o.userPHID IN (%Ls)', $this->ownerPHIDs);
     }
     if ($this->paths !== null) {
         $where[] = qsprintf($conn, 'rpath.path IN (%Ls)', $this->getFragmentsForPaths($this->paths));
     }
     if ($this->statuses !== null) {
         $where[] = qsprintf($conn, 'p.status IN (%Ls)', $this->statuses);
     }
     if ($this->controlMap) {
         $clauses = array();
         foreach ($this->controlMap as $repository_phid => $paths) {
             $fragments = $this->getFragmentsForPaths($paths);
             $clauses[] = qsprintf($conn, '(rpath.repositoryPHID = %s AND rpath.path IN (%Ls))', $repository_phid, $fragments);
         }
         $where[] = implode(' OR ', $clauses);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->credentialTypes !== null) {
         $where[] = qsprintf($conn, 'credentialType in (%Ls)', $this->credentialTypes);
     }
     if ($this->providesTypes !== null) {
         $where[] = qsprintf($conn, 'providesType IN (%Ls)', $this->providesTypes);
     }
     if ($this->isDestroyed !== null) {
         $where[] = qsprintf($conn, 'isDestroyed = %d', (int) $this->isDestroyed);
     }
     if ($this->allowConduit !== null) {
         $where[] = qsprintf($conn, 'allowConduit = %d', (int) $this->allowConduit);
     }
     if (strlen($this->nameContains)) {
         $where[] = qsprintf($conn, 'LOWER(name) LIKE %~', phutil_utf8_strtolower($this->nameContains));
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids) {
         $where[] = qsprintf($conn, 'event.id IN (%Ld)', $this->ids);
     }
     if ($this->phids) {
         $where[] = qsprintf($conn, 'event.phid IN (%Ls)', $this->phids);
     }
     if ($this->rangeBegin) {
         $where[] = qsprintf($conn, 'event.dateTo >= %d OR event.isRecurring = 1', $this->rangeBegin);
     }
     if ($this->rangeEnd) {
         $where[] = qsprintf($conn, 'event.dateFrom <= %d', $this->rangeEnd);
     }
     if ($this->inviteePHIDs !== null) {
         $where[] = qsprintf($conn, 'invitee.inviteePHID IN (%Ls)', $this->inviteePHIDs);
     }
     if ($this->creatorPHIDs) {
         $where[] = qsprintf($conn, 'event.userPHID IN (%Ls)', $this->creatorPHIDs);
     }
     if ($this->isCancelled !== null) {
         $where[] = qsprintf($conn, 'event.isCancelled = %d', (int) $this->isCancelled);
     }
     if ($this->eventsWithNoParent == true) {
         $where[] = qsprintf($conn, 'event.instanceOfEventPHID IS NULL');
     }
     if ($this->instanceSequencePairs !== null) {
         $sql = array();
         foreach ($this->instanceSequencePairs as $pair) {
             $sql[] = qsprintf($conn, '(event.instanceOfEventPHID = %s AND event.sequenceIndex = %d)', $pair[0], $pair[1]);
         }
         $where[] = qsprintf($conn, '%Q', implode(' OR ', $sql));
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'r.id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'r.phid IN (%Ls)', $this->phids);
     }
     if ($this->callsigns !== null) {
         $where[] = qsprintf($conn, 'r.callsign IN (%Ls)', $this->callsigns);
     }
     if ($this->numericIdentifiers || $this->callsignIdentifiers || $this->phidIdentifiers || $this->monogramIdentifiers || $this->slugIdentifiers) {
         $identifier_clause = array();
         if ($this->numericIdentifiers) {
             $identifier_clause[] = qsprintf($conn, 'r.id IN (%Ld)', $this->numericIdentifiers);
         }
         if ($this->callsignIdentifiers) {
             $identifier_clause[] = qsprintf($conn, 'r.callsign IN (%Ls)', $this->callsignIdentifiers);
         }
         if ($this->phidIdentifiers) {
             $identifier_clause[] = qsprintf($conn, 'r.phid IN (%Ls)', $this->phidIdentifiers);
         }
         if ($this->monogramIdentifiers) {
             $monogram_callsigns = array();
             $monogram_ids = array();
             foreach ($this->monogramIdentifiers as $identifier) {
                 if ($identifier[0] == 'r') {
                     $monogram_callsigns[] = substr($identifier, 1);
                 } else {
                     $monogram_ids[] = substr($identifier, 1);
                 }
             }
             if ($monogram_ids) {
                 $identifier_clause[] = qsprintf($conn, 'r.id IN (%Ld)', $monogram_ids);
             }
             if ($monogram_callsigns) {
                 $identifier_clause[] = qsprintf($conn, 'r.callsign IN (%Ls)', $monogram_callsigns);
             }
         }
         if ($this->slugIdentifiers) {
             $identifier_clause[] = qsprintf($conn, 'r.repositorySlug IN (%Ls)', $this->slugIdentifiers);
         }
         $where = array('(' . implode(' OR ', $identifier_clause) . ')');
     }
     if ($this->types) {
         $where[] = qsprintf($conn, 'r.versionControlSystem IN (%Ls)', $this->types);
     }
     if ($this->uuids) {
         $where[] = qsprintf($conn, 'r.uuid IN (%Ls)', $this->uuids);
     }
     if (strlen($this->nameContains)) {
         $where[] = qsprintf($conn, 'r.name LIKE %~', $this->nameContains);
     }
     if (strlen($this->datasourceQuery)) {
         // This handles having "rP" match callsigns starting with "P...".
         $query = trim($this->datasourceQuery);
         if (preg_match('/^r/', $query)) {
             $callsign = substr($query, 1);
         } else {
             $callsign = $query;
         }
         $where[] = qsprintf($conn, 'r.name LIKE %> OR r.callsign LIKE %> OR r.repositorySlug LIKE %>', $query, $callsign, $query);
     }
     if ($this->slugs !== null) {
         $where[] = qsprintf($conn, 'r.repositorySlug IN (%Ls)', $this->slugs);
     }
     if ($this->uris !== null) {
         $try_uris = $this->getNormalizedPaths();
         $try_uris = array_fuse($try_uris);
         $where[] = qsprintf($conn, 'uri.repositoryURI IN (%Ls)', $try_uris);
     }
     return $where;
 }
Esempio n. 29
0
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     $where[] = $this->buildStatusWhereClause($conn);
     $where[] = $this->buildDependenciesWhereClause($conn);
     $where[] = $this->buildOwnerWhereClause($conn);
     $where[] = $this->buildFullTextWhereClause($conn);
     if ($this->taskIDs !== null) {
         $where[] = qsprintf($conn, 'task.id in (%Ld)', $this->taskIDs);
     }
     if ($this->taskPHIDs !== null) {
         $where[] = qsprintf($conn, 'task.phid in (%Ls)', $this->taskPHIDs);
     }
     if ($this->statuses !== null) {
         $where[] = qsprintf($conn, 'task.status IN (%Ls)', $this->statuses);
     }
     if ($this->authorPHIDs !== null) {
         $where[] = qsprintf($conn, 'task.authorPHID in (%Ls)', $this->authorPHIDs);
     }
     if ($this->dateCreatedAfter) {
         $where[] = qsprintf($conn, 'task.dateCreated >= %d', $this->dateCreatedAfter);
     }
     if ($this->dateCreatedBefore) {
         $where[] = qsprintf($conn, 'task.dateCreated <= %d', $this->dateCreatedBefore);
     }
     if ($this->dateModifiedAfter) {
         $where[] = qsprintf($conn, 'task.dateModified >= %d', $this->dateModifiedAfter);
     }
     if ($this->dateModifiedBefore) {
         $where[] = qsprintf($conn, 'task.dateModified <= %d', $this->dateModifiedBefore);
     }
     if ($this->priorities !== null) {
         $where[] = qsprintf($conn, 'task.priority IN (%Ld)', $this->priorities);
     }
     if ($this->subpriorities !== null) {
         $where[] = qsprintf($conn, 'task.subpriority IN (%Lf)', $this->subpriorities);
     }
     if ($this->subpriorityMin !== null) {
         $where[] = qsprintf($conn, 'task.subpriority >= %f', $this->subpriorityMin);
     }
     if ($this->subpriorityMax !== null) {
         $where[] = qsprintf($conn, 'task.subpriority <= %f', $this->subpriorityMax);
     }
     if ($this->bridgedObjectPHIDs !== null) {
         $where[] = qsprintf($conn, 'task.bridgedObjectPHID IN (%Ls)', $this->bridgedObjectPHIDs);
     }
     return $where;
 }
 protected function buildWhereClauseParts(AphrontDatabaseConnection $conn)
 {
     $where = parent::buildWhereClauseParts($conn);
     if ($this->ids !== null) {
         $where[] = qsprintf($conn, 'id IN (%Ld)', $this->ids);
     }
     if ($this->phids !== null) {
         $where[] = qsprintf($conn, 'phid IN (%Ls)', $this->phids);
     }
     if ($this->buildablePHIDs !== null) {
         $where[] = qsprintf($conn, 'buildablePHID IN (%Ls)', $this->buildablePHIDs);
     }
     if ($this->containerPHIDs !== null) {
         $where[] = qsprintf($conn, 'containerPHID in (%Ls)', $this->containerPHIDs);
     }
     if ($this->statuses !== null) {
         $where[] = qsprintf($conn, 'buildableStatus in (%Ls)', $this->statuses);
     }
     if ($this->manualBuildables !== null) {
         $where[] = qsprintf($conn, 'isManualBuildable = %d', (int) $this->manualBuildables);
     }
     return $where;
 }