adding comments to ponder

Summary: This is pretty spartan, but it does the job.

Test Plan:
Patch, update storage, add some comment
to your favorite question or answer.

Reviewers: nh, vrana, epriestley

Reviewed By: epriestley

CC: aran, Korvin, starruler, syrneus, me.here, victorzarate7

Maniphest Tasks: T1645

Differential Revision: https://secure.phabricator.com/D3471
Add paste policy storage

Summary: Add storage to Pastes for view policies.

Test Plan: Set policies on pastes, see next diff.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D3474
Allow projects to be set as policies

Summary:
  - Renames `PhabricatorPolicyQuery` to `PhabricatorPolicyAwareQuery` (a query which respects policy settings).
  - Introduces `PhabricatorPolicyQuery`, which loads available policies (e.g., "member of project X").
  - Introduces `PhabricatorPolicy`, which describes a policy.
  - Allows projects to be set as policies.
  - Allows Paste policies to be edited.
  - Covers crazy cases where you make projects depend on themselves or each other because you are a dastardly villan.

Test Plan: Set paste and project policies, including crazy policies like A -> B -> A, A -> A, etc.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Maniphest Tasks: T603

Differential Revision: https://secure.phabricator.com/D3476
Hide Ponder add comment behind link

Summary: Does what it says on the tin

Test Plan: Viewed ponder question, expanded link, added comment

Reviewers: pieter, epriestley

Reviewed By: pieter

CC: vrana, aran, Korvin

Maniphest Tasks: T1775

Differential Revision: https://secure.phabricator.com/D3485
Fix error in ponder comment hiding.

Summary: I'm a tard

Test Plan: - view page

Reviewers: pieter

Reviewed By: pieter

CC: aran, epriestley, vrana

Maniphest Tasks: T1775

Differential Revision: https://secure.phabricator.com/D3487
Open editor on highlighted line in Diffusion

Test Plan:
Edited:

  path$33
  path$33-35
  path

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3488
fix ponder escaping issue

Summary: Question titles were not escaped; now they are.

Test Plan: Observe the escaping.

Reviewers: epriestley

Reviewed By: epriestley

CC: nh, aran, Korvin

Differential Revision: https://secure.phabricator.com/D3490
Fix GitHub login failure for user with username "0".
Fix another missing strlen for users with username "0".
Fix one more issue for username "0".
Use 'w' connection in `bin/storage`

Test Plan:
Built a DB provider using readonly connection for 'r' mode. Then:

  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3484
Enforce blame in Skip Past This Commit

Test Plan:
# Set default view to non-blame.
# Visit URL with '?view=blame'.
# Click //Skip Past This Commit//.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3494
Make it more clear that "Public" really means "Public"

Summary: In the long term I think we can probably just explain this feature better, but for now I want to make sure no one makes a mistake with "Public". This seems like a reasonable way to do it.

Test Plan: Looked at the policy selector dropdown.

Reviewers: vrana, btrahan

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D3486
Do sampled profiling of requests

Summary:
People have occasionally complained about phabricator being slow. We have
the access log to look at to see when slowness happens, but it doesn't tell
us much about why it happened. Since it's usually a sporadic issue that's
reported, it's hard to reproduce and then profile. This change will allow us
to collect sampled profiles so we can look at them when slowness occurs.

Test Plan:
checking that sampling works correctly:
- set rate to 0; do several page loads; check no new entries in table
- set rate to 1; check that there's a new row in the table for each page load
- set rate to 10; check that some requests write to table and some don't
check new ui for samples:
- load /xhprof/list/all/, see a list with a lot of samples
- load /xhprof/list/sampled/, see only sampled runs
- load /xhprof/list/manual/, see only non-sampled runs
- load /xhprof/list/my-runs/, se only my manual runs

Reviewers: vrana, epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3458
Fix bad rebase

Auditors: nh
Optimize reindex_everything.php

Summary:
We have two troubles with this script:

# Our revisions and commits don't fit in the memory. (Our tasks do :-).)
# Reindexing revisions is slow.

Test Plan: Ran it.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3483
Unuse short ternary operator

Summary: We still support PHP 5.2.

Test Plan:
  $ arc lint

Reviewers: nh, epriestley

Reviewed By: epriestley

CC: aran, epriestley

Differential Revision: https://secure.phabricator.com/D3503
Disallow contentless Ponder answers

Summary:
Any answer without non whitespace characters results in an
error.

Test Plan:
 - Submitted an empty answer, was told off
 - Submitted an answer full of whitespace, didn't like that either
 - Submitted a real answer, accepted

Reviewers: pieter, epriestley, vrana

Reviewed By: epriestley

CC: aran, Korvin, davidreuss

Maniphest Tasks: T1644

Differential Revision: https://secure.phabricator.com/D3492
Disallow contentless ponder questions

Test Plan:
* submitted various comments (empty, whitespace, real) and
verified response

Reviewers: pieter, epriestley

CC: vrana, aran, Korvin

Maniphest Tasks: T1644

Differential Revision: https://secure.phabricator.com/D3505
Add Haskell and Objective-C syntax highlighting to paste

Summary:
Pygments already supports Haskell and Objective-C syntax
highlighting, but the default in Phabricator excluded them from the
dropdown for the paste tool.

This adds Haskell and Objective-C to the default list of languages.

Test Plan:
Started up Phabricator sandbox instance, confirmed Haskell
and Objective-C worked in paste app.

Reviewers: vrana, epriestley

Reviewed By: vrana

CC: aran, Korvin

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