Make "Edit Query" a more visible button in ApplicationSearch

Summary: Ref T2625. See disucssion in D6347.

Test Plan:
{F48515}
{F48516}
{F48517}
{F48518}

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2625

Differential Revision: https://secure.phabricator.com/D6348
Add "state icons" to ObjectItemListView

Summary: They seem to look OK?

Test Plan: {F48529} {F48530}

Reviewers: chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6350
Move "scripts/sql/probe.php" to "bin/storage probe"

Summary: This makes it namespace/database/connection aware and a little easier to find. Also use pht() / PhutilConsole.

Test Plan: Ran `bin/storage probe`.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6341
Update S3 external library

Summary:
This fixes at least two issues with the S3 library on newer versions of cURL/PHP:

  - NOTICE: PHP message: [2013-07-02 22:15:54] ERROR 8: curl_setopt(): CURLOPT_SSL_VERIFYHOST with value 1 is deprecated and will be removed as of libcurl 7.28.1. It is recommended to use value 2 instead at [/core/lib/phabricator/externals/s3/S3.php:1744]
  - `$this->request->body` was appended to without initializing it, which rasies an error on PHP 5.5.0.

I looked over the rest of the changes briefly and they all seem reasonable-ish.

Test Plan:
  - Uploaded a file to S3.
  - Downloaded a file from S3.
  - Deleted a file from S3.
  - Checked error logs for anything suspicious.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D6349
Add the quick shortcut to create an image macro. Maybe.

I don't actually have Phabricator installed locally so I have no idea if this works, but in theory this should add one of the + buttons in the left sidebar to quickly add a new macro.
Merge pull request #351 from grpaul/patch-1

Add the quick shortcut to create an image macro. Maybe.
Simplify construction and execution of Differential queries for "responsible" users

Summary:
Currently, when querying for responsible users (revisions where a given user is either the author or a reviewer), we do this:

  - If the query passes a bunch of hard-coded special cases, use a special hard-coded UNION.
  - Otherwise, use a very complicated JOIN/WHERE clause.

This is bad for several reasons:

  - Tons and tons of hard-coding and special casing.
  - The JOIN/WHERE clause performs very poorly for large datasets.
  - (As a material consequence, the homepage issues a responsible query which barely misses the hard-coded special cases and goes down the slow path.)

Instead, //always// use the UNION strategy to execute a "responsible" query. Specifically, if we have responsible PHIDs, temporarily add them to the author list and build a normal query, then repeat for reviewers, then UNION any clauses we built.

Fixes T3377. Ref T603. Ref T2625. Depends on D6342.

There's various folklore about UNION ALL / UNION DISTINCT performance. UNION DISTINCT is simpler here and the number of rows is small, although we could use UNION ALL in the form:

  SELECT * FROM ((SELECT ...) UNION ALL (SELECT ...) ORDER) GROUP LIMIT

...if we find that there's some performance benefit at some point.

Test Plan: Used DarkConsole to examine queries. Viewed home page and Differential dashboard/authors/subscribers.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603, T2625, T3377

Differential Revision: https://secure.phabricator.com/D6343
Make DifferentialRevisionQuery policy-aware

Summary:
Ref T603. Ref T2625. Makes `DifferentialRevisionQuery` do policy checks.

Note that it still uses inefficient offset-based paging, but it's rare to page through revisions. I'll switch to cursor paging in a future diff.

Test Plan: Viewed a bunch of Differential interfaces, home page, etc. This shouldn't actually materially impact anything.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603, T2625

Differential Revision: https://secure.phabricator.com/D6344
Use cursor-based paging in Differential

Summary:
Ref T603. Ref T2625. Use cursors to page Differential queries, not offsets.

The trick here is that some queries are ordered. In these cases, we either need to pass some kind of tuple or do a cursor lookup. For example, if you are viewing revisions ordered by `dateModified`, we can either have the next page be something like:

  ?afterDateModified=2398329373&afterID=292&order=modified

...or some magical token:

  ?afterToken=2398329373:292&order=modified

I think we did this in Conpherence, but one factor there was that paging orders update with some frequency. In most cases, I think it's reasonable to pass just the ID and do a lookup to get the actual clause value (e.g., go look up object ID 292 and see what its dateModified is) and I think this is much simpler in general.

Test Plan: Set page size in Differential to 3, and paged through result lists ordered by date created and date modified.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603, T2625

Differential Revision: https://secure.phabricator.com/D6345
Provide PhabricatorSavedQuery to renderResultsList()

Summary: This allows the SavedQuery to modify what the result list looks like (e.g., include display flags and similar).

Test Plan: Looked at some ApplicationSearch apps.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2625

Differential Revision: https://secure.phabricator.com/D6346
[Rough Sketch] Differential ObjectItemView Smexyness

Summary:
Tried out `PhabricatorObjectItemView` for Differential. It looks smexy and smooth.

Refs T2014

- Title and Date as Maniphest
- Author in the handle icon
- Bar color reflects revision status (Needs Review, Accepted, Abandoned etc.) @chad looking for non-blue is faster than keeping watch for everything that's not "Closed" in old table form
- Some status information are in footer icons; currently only stale/old status display as well as saved drafts, maybe more in future; these come into my mind:
  - No reviewer warning
  - Push Blocking Priority (T2730)
  - Trivial, fast review guaranteed
  - Sketch / Just looking for advice/help
  - Arcanist Project (T2614)
  - Denote "Public Send-in" (T1476)

{F37662}
{F37663}
{F37664}
{F37665}

Some flaws:

- Date and reviewers on every entry the same?
- No respect for Differential fields (for some reason, every entry appeared the same, so broke it to parts)
- Plenty of (potential) increase in height - advise reducing paging length from 100 to 50 - or just ignore me

Suggestions for the future:

- Expand the meta information regarding revisions; e.g. the various status displays above
- Uh... T2543, T1279, T793, T731 and what else I want for Differential, because they are awesome!
- T793 should be in particular easy appearance-wise, just copy-paste from Maniphest

Test Plan: By looking at it, of course. Verified there are no errors or crashed

Reviewers: epriestley, chad, btrahan, liguobig

Reviewed By: chad

CC: aran, Korvin, edward, nh

Maniphest Tasks: T2014

Differential Revision: https://secure.phabricator.com/D5451

Conflicts:
	src/__celerity_resource_map__.php
Use ApplicationSearch in Differential

Summary:
Ref T603. Ref T2625. Fixes T3241. Depends on D5451. Depends on D6346.

@wez, this changes the Differential revision list UI substantially and may generate a lot of bikeshedding / who-moved-my-cheese churn. See T3417 for context, for example. The motivations for this change are:

  - The list now works on devices, like phones and tablets. This is a requirement to make the rest of Differential work on devices.
  - Although ApplicationSearch intentionally presents a simpler interface initially and some options which were one click away before aren't now, it is much more powerful than the search it replaces and allows users to build, save, share, fork, edit, and customize a much wider range of queries. Users who used the old filters frequently can use Advanced Search -> Save Custom Query to create new versions of them, and of any other query. "Edit Queries.." allows users to remove and reorder queries, including builtin queries. Basically, there are like three things which have gone from "1-click" to "a few clicks", and ten trillion things which have gone from "hard/impossible" to "relatively easy".

The local screenshots look a bit iffy, but I think a lot of this is the fakenesss of my test data. If they still feel iffy in production we can tweak them until they feel good, like we did for Maniphest.

Test Plan:
{F48477}

{F48478}

Reviewers: btrahan, chad, wez

Reviewed By: btrahan

CC: aran, s

Maniphest Tasks: T603, T2625, T3241

Differential Revision: https://secure.phabricator.com/D6347
Minor, fix some margins on the homepage directory view.
Provide clearer syntax highlighting for phame posts. Including background colour, overflow scrolling and border. Also support for tt tag differentiation

Summary: Clode blocks are now much clearer in blog posts with the usage of a bg color, border and scrolling for overflowing content

Test Plan: Create a phame post with a code block and see the visual difference

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, chad

Differential Revision: https://secure.phabricator.com/D6320
Move "Stale" / "Old" to date icon in Differential list view

Summary: Ref T3485. Moves "Stale" / "Old" to the right.

Test Plan: {F48653}

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T3485

Differential Revision: https://secure.phabricator.com/D6354
Move flag icon inline with header in Differential revision list

Summary: Ref T3485. Moves flag icon inline in the header.

Test Plan: {F48654}

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T3485

Differential Revision: https://secure.phabricator.com/D6355
Show draft icon in attributes?

Summary: Ref T3485. Maybe this is OK?

Test Plan: {F48656}

Reviewers: chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T3485

Differential Revision: https://secure.phabricator.com/D6356
Revert "Add "state icons" to ObjectItemListView"

Summary: This reverts commit e70bb28ea00d16b4fac634edbbcb55d5b574126f. We didn't end up using these.

Test Plan: Looked at Differential.

Reviewers: chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6357
Fix shadown on aphront filter viewy

Summary: Fixes T3478, adds a wrap with a border.

Test Plan: Reload page.

Reviewers: epriestley

CC: aran, Korvin

Maniphest Tasks: T3478

Differential Revision: https://secure.phabricator.com/D6358
Fix margins and spacing of other revision lists

Summary: Fixes spacing in Differential revision detail and Diffusion browse views.

Test Plan:
{F48677}
{F48678}

Reviewers: chad

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D6359