Continue cleaning up queries in the wake of changes to "%Q"

Summary: Depends on D19810. Ref T13217. Ref T13216. I mostly used `grep implode | grep OR` and `grep implode | grep AND` to find these -- not totally exhaustive but should be a big chunk of the callsites that are missing `%LO` / `%LA`.

Test Plan:
These are tricky to test exhaustively, but I made an attempt to hit most of them:

- Browsed Almanac interfaces.
- Created/browsed Calendar events.
- Enabled/disabled/showed the lock log.
- Browsed repositories.
- Loaded Facts UI.
- Poked at Multimeter.
- Used typeahead for users and projects.
- Browsed Phriction.
- Ran various fulltext searches.

Not sure these are reachable:

- All the lint stuff might be dead/unreachable/nonfunctional?

Reviewers: amckinley

Reviewed By: amckinley

Subscribers: yelirekim

Maniphest Tasks: T13217, T13216

Differential Revision: https://secure.phabricator.com/D19814
This commit is contained in:
epriestley
2018-11-15 05:53:34 -08:00
parent 49483bdb48
commit 933462b487
15 changed files with 59 additions and 44 deletions

View File

@@ -1440,7 +1440,11 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
$key);
}
return implode(' ', $joins);
if ($joins) {
return qsprintf($conn, '%LJ', $joins);
} else {
return qsprintf($conn, '');
}
}
/**
@@ -1516,7 +1520,7 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
}
if ($constraint_parts) {
$where[] = '('.implode(') OR (', $constraint_parts).')';
$where[] = qsprintf($conn, '%LO', $constraint_parts);
}
break;
}
@@ -1670,7 +1674,7 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
}
if (!$this->ferretEngine) {
$select[] = '0 _ft_rank';
$select[] = qsprintf($conn, '0 _ft_rank');
return $select;
}
@@ -1736,12 +1740,21 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
}
}
$parts[] = '0';
$parts[] = qsprintf($conn, '%d', 0);
$sum = array_shift($parts);
foreach ($parts as $part) {
$sum = qsprintf(
$conn,
'%Q + %Q',
$sum,
$part);
}
$select[] = qsprintf(
$conn,
'%Q _ft_rank',
implode(' + ', $parts));
$sum);
return $select;
}
@@ -2031,20 +2044,20 @@ abstract class PhabricatorCursorPagedPolicyAwareQuery
if ($is_not) {
$where[] = qsprintf(
$conn,
'(%Q)',
implode(' AND ', $term_constraints));
'%LA',
$term_constraints);
} else if ($is_quoted) {
$where[] = qsprintf(
$conn,
'(%T.rawCorpus LIKE %~ AND (%Q))',
'(%T.rawCorpus LIKE %~ AND %LO)',
$table_alias,
$value,
implode(' OR ', $term_constraints));
$term_constraints);
} else {
$where[] = qsprintf(
$conn,
'(%Q)',
implode(' OR ', $term_constraints));
'%LO',
$term_constraints);
}
}