Make `./bin/diviner generate` more fault tolerant

Summary: Allow `./bin/diviner generate` to continue even if there is an exception throw processing an atom. This allows Diviner documentation to be generated for PHP source code that cannot be parsed with XHPAST.

Test Plan: Ran `./bin/diviner generate` on a PHP repository which previously throw an `XHPASTSyntaxErrorException`.

Reviewers: btrahan, epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D10803
Phriction - sever remaining project ties

Summary: 'cuz the wiki don't play that no more. Fixes T6497. This is mainly important to fix an incorrect policy filtering issue where a project policy can incorrectly override a document policy. Otherwise, it makes things nice and clean.

Test Plan:
- viewed the wiki - success.
- viewed wiki document list under "index" and tried a few different queries
- grep'd for things like "hasProject" and "getProject" and saw no phriction-related results

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6497

Differential Revision: https://secure.phabricator.com/D10818
Phriction - if you can't edit x/y don't allow creating x/y/z

Summary: ...how do you lock down entire areas otherwise? Fixes T6496.

Test Plan: used user 1 to create x/y that user 2 can't edit. tried to create x/y/z as user 2 and got a big ole error dialogue.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6496

Differential Revision: https://secure.phabricator.com/D10819
Add icon, color and profile image to project.query

Summary:
 - The icon CSS tag is transformed through the new function
   PhabricatorProjectIcon::getAPIName($key), which returns
   a name without fa-.

 - Color is a trivial lookup
 - Profile image returns the PHID or null if not available

Test Plan:
 - Create two projects, with different icon and color,
   one with and one without profile image.
 - Request information on both using project.query
Then:
 [ ] Confirm icon and colors are correct for both projects
 [ ] Confirm image PHID is correct
 [ ] Confirm image PHID is null for the project without image

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: yuvipanda, Korvin, legoktm, epriestley

Maniphest Tasks: T6501

Differential Revision: https://secure.phabricator.com/D10823
Separate SSH key management from the settings panel

Summary:
Ref T5833. I want to add SSH keys to Almanac devices, but the edit workflows for them are currently bound tightly to users.

Instead, decouple key management from users and the settings panel.

Test Plan:
  - Uploaded, generated, edited and deleted SSH keys.
  - Hit missing name, missing key, bad key format, duplicate key errors.
  - Edited/generated/deleted/etc keys for a bot user as an administrator.
  - Got HiSec'd on everything.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5833

Differential Revision: https://secure.phabricator.com/D10824
Allow Almanac devices to have SSH keys

Summary: Ref T5833. Expose a key management interface for Almanac devices.

Test Plan: {F231962}

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5833

Differential Revision: https://secure.phabricator.com/D10825
Clean up line-height on feed stories

Summary: Resets line-height, removes unused CSS.

Test Plan: Test long paragraphs in feed stories.

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D10828
Minor, style multiple blockquote levels in Remarkup

Summary: Adds minor styling

Test Plan:
quote lots of comments

{F232592}

Reviewers: btrahan, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D10829
Phriction - stop leaking document titles you can't see

Summary: Fixes T6495. convert ad hoc query to a PhrictionDocumentQuery, thus enforcing view permissions

Test Plan: noted my test user a had a great wiki while test user b couldn't see most things.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6495

Differential Revision: https://secure.phabricator.com/D10822
Phriction - kill off rest of project integration

Summary: we don't need this stuff no mo'.  Fixes T6506.

Test Plan: cruised the wiki, noting workingess

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6506

Differential Revision: https://secure.phabricator.com/D10832
Config migration script bug fix

Summary: i think way back in D10490 I didn't incorporate feedback correctly. make this code right as it fatals in this codepath as is. Fixes T6508.

Test Plan: @joshuaspence to the rescue  (I remain unable to test this effectively with my baby-clean installation.)

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley, joshuaspence

Maniphest Tasks: T6508

Differential Revision: https://secure.phabricator.com/D10833
Fix Phriction document migration after project magic removal

Summary: See <https://github.com/phacility/phabricator/issues/760>. We removed these methods in D10832 but still need the migration to be able to do project checks.

Test Plan: Ran on a test wiki with `/`, `/projects/` and `/projects/example/`. The first two pages didn't try to use project policies; the third one did.

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D10836
Phriction - fix "unknown policy" on document create

Summary: when creating new documents the policy object wasn't being initialized properly. update the code to use the new handy initializeNewDocument method. Fixes T6527.

Test Plan: viewed a doc at /w/asdsadsadsdas/ and saw the correct policy setting

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6527

Differential Revision: https://secure.phabricator.com/D10837
Ref T6500, Duplicated tasks should be marked more visibly as duplicates

Summary: When merging tasks, the corresponding transaction on the merged task should be black, and the transaction on the ultimate task should be green.

Test Plan: Create two tasks, merge one into the other, merged task transaction is black, the surviving task should show a green transaction.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: chad, Korvin, epriestley

Maniphest Tasks: T6500

Differential Revision: https://secure.phabricator.com/D10827
T4666, Support Herald in Phriction

Summary: Fixes T4666, add Herald rules to Phriction Documents

Test Plan: add Herald rule to flag if title contains "xyz", create Phriction Document with title "xyz". Phriction Document should be flagged.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Maniphest Tasks: T4666

Differential Revision: https://secure.phabricator.com/D10830
Fix minor issues with PhrictionDocumentQuery

Summary:

  - Order checks used `=` but intended `==`. We could probably write a lint rule for this.
  - Selecting `*` with a join could pick (for example) `id` columns from both the document and content tables and end up using the wrong one.
  - `%Q` expects a string and chokes on `null`.

Auditors: btrahan
Improve Phriction page move dialog

Summary:
Fixes T5492. I figured this would be easier to just fix than write a guide for; it actually took me an hour, but I spent like 75% of that futzing with my editor.

  - The Move controller currently accepts either a slug or an ID. I can't find any callsites which pass a slug, and this doesn't make sense. Pretty sure this was copy/pasted from Edit or something. Only accept IDs.
  - Slightly modernize the Move controller (newDialog(), handleRequest(), $viewer).
  - When the user enters a bad slug, warn them that we're going to fix it for them and let them accept or reject the changes.
  - Don't prefill the edit note (this feels inconsistent/unusual).
  - On the form, label the input "Path" instead of "URI".
  - Show the old path, to help remind the user what the input should look like.
  - When a user tries to do a no-op move, show a more tailored message.
  - When the user tries to do an overwriting move, explain how they can fix it.
  - When normalizing a slug like `/question/???/mark/`, make it normalize to `/question/_/mark`.

Test Plan:
  - Tried to move a document to itself.
  - Tried to overwrite a document.
  - Did a bad-path move, accepted corrected path.
  - Did a good-path move.
  - Did a path move with a weird component like `/???/`.
  - Added and executed unit tests.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T5492

Differential Revision: https://secure.phabricator.com/D10838
Diffusion - default hosting options on during repository creation

Summary: ...if pertinent environment variables are set that is... Fixes T4151. This is the last piece in making repository creation somewhat easier.

Test Plan: made a new repo and noted that http serving was on r/w and ssh serving was still off, as expected for my environment configuration

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T4151

Differential Revision: https://secure.phabricator.com/D10839
Config - improve lock message for option `phabricator.uninstalled-applications`

Summary: Fixes T6175. This particular option is only editable via the Applications application so let the user know that.

Test Plan: saw error message and clicked through to applications app. tried another locked option and saw old message

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6175

Differential Revision: https://secure.phabricator.com/D10841
diffusion / differential - better handle case where no comment selected

Summary: Right now, if no comment is selected the JS executes and throws an exception. Instead, if nothing is selected just do nothing. Fixes T6107.

Test Plan: opened up a commit in diffusion with an inline comment. pressed 'r' and saw no exceptions and nothing happen. pressed 'n' to select the next inline comment and then 'r' and it worked. opened up a commit in diffusion without any inline comments. pressed 'r' and saw no exceptions and nothing happen. opened up a diff in differential with an inline comment. pressed 'r' and saw no exceptons and nothing happened. pressed 'n' to select the next inline comment and then 'r' and it worked.

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: Korvin, epriestley

Maniphest Tasks: T6107

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