Partial fix for owners bug where a package's repository doesn't exist.

Summary: Avoid requesting a non-existent repository...

Test Plan: Delete a repo that has an associated owners package. Then verify that the owners list page no longer throws an exception.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1372

Differential Revision: https://secure.phabricator.com/D2776
Enable 'jumping to toc' on diffusion commit page

Summary:
Diffusion page is sharing the keyboard shortcuts code with
Differential page. But since the toc (Changes) panel doesn't have id
'differential-review-toc', the 'jumping to toc' doesn't work. The fix is
to add the ID. I don't like adding 'Differential' to the Diffusion page.
Later we should refactor the code to extract the shared components out of Differential.

Test Plan:
verified that 't' worked on the diffusion commit page.

Reviewers: epriestley, nh

Reviewed By: epriestley

CC: hwang, aran, Korvin

Differential Revision: https://secure.phabricator.com/D2500
Send Differential e-mails in user's language

Summary:
Works this way:

- Select users' language with multiplexing.
- Select default language otherwise (it can be different from current user's language).
- Build body and subject for each user individually.
- Set the original language after sending the mails.

Test Plan:
- Comment on a diff of user with custom translation.
- Set default to a custom translation. Comment on a diff of user with default translation.
- Set default to a default translation. Comment on a diff of user with default translation.

Repeat with/without multiplexing.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1139

Differential Revision: https://secure.phabricator.com/D2774
Fix principal error in makeChangesWithContext()

Summary: `array_fill()`, contrary to `range()`, doesn't accept the last element but the number of elements.

Test Plan: Reparsed commit not changed after the last diff but rebased which was previously reported as changed.

Reviewers: jungejason, epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D2783
Add a list of all notifications

Summary: Add a "View All Notifications" link and page.

Test Plan: Viewed all notifications

Reviewers: jungejason, vrana

Reviewed By: jungejason

CC: aran

Maniphest Tasks: T974

Differential Revision: https://secure.phabricator.com/D2780
Show only one "reload" popup, use 'alert' style, click to reload

Summary: Use the features from D2758.

Test Plan: Updated T1 with two browser windows pointing at it, verified reload appeared, only one reload, and it appeared with 'alert' style.

Reviewers: jungejason, vrana

Reviewed By: jungejason

CC: aran

Maniphest Tasks: T944

Differential Revision: https://secure.phabricator.com/D2781
Show notification text for non-reload notifications

Summary:
Show all notifications, but make the non-reload ones transient.

Depends on D2781, D2780

Test Plan: {F12986}

Reviewers: jungejason, vrana

Reviewed By: jungejason

CC: aran

Maniphest Tasks: T944

Differential Revision: https://secure.phabricator.com/D2782
Add a `bin/aphlict` wrapper to handle aphlict config / daemonization

Summary: Simple wrapper script to configure, launch, daemonize and restart the Aphlict server.

Test Plan: Ran "bin/aphlict", checked /notification/status/. Ran "bin/aphlict --foreground".

Reviewers: jungejason, vrana

Reviewed By: jungejason

CC: aran

Maniphest Tasks: T944

Differential Revision: https://secure.phabricator.com/D2784
Always use HTTPSFuture in elasticsearch.

Test Plan: Search elasticly.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D2685
Minor, fix Aphlict wrapper signal handling issue under dash.
Add path support to differential.query

Summary:
Allows clients to select open differential revisions that
affect a set of paths.

Test Plan:
http://phabricator.mkedia.dev2975.facebook.com/conduit/method/differential.query/ with

paths: [["E", "tfb/trunk/www/html/intern/css/tabloid"]]
status: "status-open"

(internal facebook repo, obvi)

Reviewers: epriestley, btrahan

Reviewed By: epriestley

CC: vrana, aran, Korvin

Differential Revision: https://secure.phabricator.com/D2788
Get rid of file_get_contents($uri)

Summary: It requires `allow_url_fopen` which we don't check in setup and our installation is about to disable it.

Test Plan:
Login with OAuth.
/oauth/facebook/diagnose/

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D2787
Fix displaying of inlines related both to visible and hidden diff

Summary: I tried also filling the column by empty space but this looks better.

Test Plan: Displayed a comment both with visible and hidden inlines.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T1216

Differential Revision: https://secure.phabricator.com/D2789
Link libphutil docs
Arrayish fields should always return arrays

Summary:
Array-like fields in HerladCommitAdapter should always return things of
type array.  If they return array(...) or null, then array_*() functions
sporadically break.

Test Plan:
Ran a PhabricatorRepositoryCommitHeraldWorker for a troublesome commit.
Failed before; fails no more.

Reviewers: epriestley, jungejason

Reviewed By: epriestley

CC: aran, Korvin, vdt

Maniphest Tasks: T1385

Differential Revision: https://secure.phabricator.com/D2793
Provide a script to completely destroy revisions

Summary:
Someone may or may not have accidentally uploaded secrets to Differential. Provide an administrative mechanism to permanently destroy a revision.

Also fix some of the transaction handling code.

Test Plan:
  $ ./scripts/differential/destroy_revision.php --trace D1
  >>> [0] <connect>
  <<< [0] <connect> 1,060 us
  >>> [1] <query> SELECT * FROM `differential_revision` WHERE `id` = 1
  <<< [1] <query> 473 us

      Really destroy 'D1: asdbas' forever? [y/N] y

  >>> [2] <connect>
  <<< [2] <connect> 628 us
  >>> [3] <query> START TRANSACTION
  <<< [3] <query> 190 us
  >>> [4] <query> SELECT * FROM `differential_diff` WHERE revisionID = 1
  <<< [4] <query> 510 us
  >>> [5] <query> SAVEPOINT Aphront_Savepoint_1
  <<< [5] <query> 122 us
  >>> [6] <query> SELECT * FROM `differential_changeset` WHERE diffID = 1
  <<< [6] <query> 307 us
  >>> [7] <query> SAVEPOINT Aphront_Savepoint_2
  <<< [7] <query> 241 us
  >>> [8] <query> SELECT * FROM `differential_hunk` WHERE changesetID = 1
  <<< [8] <query> 212 us
  >>> [9] <query> DELETE FROM `differential_hunk` WHERE `id` = 1
  <<< [9] <query> 216 us
  >>> [10] <query> DELETE FROM `differential_changeset` WHERE `id` = 1
  <<< [10] <query> 154 us
  >>> [11] <query> SAVEPOINT Aphront_Savepoint_2
  <<< [11] <query> 118 us
  >>> [12] <query> SELECT * FROM `differential_hunk` WHERE changesetID = 2
  <<< [12] <query> 194 us
  >>> [13] <query> DELETE FROM `differential_hunk` WHERE `id` = 2
  <<< [13] <query> 179 us
  >>> [14] <query> DELETE FROM `differential_changeset` WHERE `id` = 2
  <<< [14] <query> 163 us
  >>> [15] <query> SAVEPOINT Aphront_Savepoint_2
  <<< [15] <query> 105 us
  >>> [16] <query> SELECT * FROM `differential_hunk` WHERE changesetID = 3
  <<< [16] <query> 211 us
  >>> [17] <query> DELETE FROM `differential_hunk` WHERE `id` = 3
  <<< [17] <query> 159 us
  >>> [18] <query> DELETE FROM `differential_changeset` WHERE `id` = 3
  <<< [18] <query> 152 us
  >>> [19] <query> SAVEPOINT Aphront_Savepoint_2
  <<< [19] <query> 124 us
  >>> [20] <query> SELECT * FROM `differential_hunk` WHERE changesetID = 4
  <<< [20] <query> 191 us
  >>> [21] <query> DELETE FROM `differential_hunk` WHERE `id` = 4
  <<< [21] <query> 155 us
  >>> [22] <query> DELETE FROM `differential_changeset` WHERE `id` = 4
  <<< [22] <query> 149 us
  >>> [23] <query> SELECT * FROM `differential_diffproperty` WHERE diffID = 1
  <<< [23] <query> 242 us
  >>> [24] <query> DELETE FROM `differential_diffproperty` WHERE `id` = 1
  <<< [24] <query> 196 us
  >>> [25] <query> DELETE FROM `differential_diff` WHERE `id` = 1
  <<< [25] <query> 169 us
  >>> [26] <query> DELETE FROM `differential_relationship` WHERE revisionID = 1
  <<< [26] <query> 178 us
  >>> [27] <query> DELETE FROM `differential_commit` WHERE revisionID = 1
  <<< [27] <query> 164 us
  >>> [28] <query> SELECT * FROM `differential_comment` WHERE revisionID = 1
  <<< [28] <query> 221 us
  >>> [29] <query> DELETE FROM `differential_comment` WHERE `id` = 1
  <<< [29] <query> 172 us
  >>> [30] <query> SELECT * FROM `differential_inlinecomment` WHERE revisionID = 1
  <<< [30] <query> 296 us
  >>> [31] <query> SELECT * FROM `differential_auxiliaryfield` WHERE revisionPHID = 'PHID-DREV-ooky7ozqukpmwget32oc'
  <<< [31] <query> 308 us
  >>> [32] <query> SELECT * FROM `differential_affectedpath` WHERE revisionID = 1
  <<< [32] <query> 4,173 us
  >>> [33] <query> DELETE FROM `differential_revision` WHERE `id` = 1
  <<< [33] <query> 231 us
  >>> [34] <query> COMMIT
  <<< [34] <query> 686 us
  OK, destroyed revision.

Reviewers: csilvers, vrana, jungejason

Reviewed By: csilvers

CC: aran

Differential Revision: https://secure.phabricator.com/D2796
Add `--verbose` support to phd

Summary:
Support the `--verbose` flag added in D2795 in `phd`. See T1389.

Also simplify argument generation a little bit.

Test Plan: Ran "nice" daemon with debug,  daemon + verbose, daemon + no verbose.

Reviewers: vrana, jungejason, edward, aurelijus

Reviewed By: aurelijus

CC: aran

Maniphest Tasks: T1389

Differential Revision: https://secure.phabricator.com/D2797
Don't rediscover an entire branch when a new commit appears at HEAD

Summary:
The autoclose logic is currently doing a little too much work. We want to parse each commit at most twice:

  # When it first appears in the repository.
  # When it first appears on an autoclose branch.

These two events might not be distinct (i.e., it might first appear on an autoclose branch).

Currently, to discover commits initially appearing on autoclose branches, we check each branch, determine if it's an autoclose branch or not, and determine if the HEAD is already a known commit on an autoclose branch. This is correct so far, and allows us to ignore branches which either haven't changed or have commits at HEAD which we've already examined.

However, if an autoclose branch has a new commit, we start working backward through it. Prior to this patch, we only stop when we hit commits that we've already discovered lie on this branch. If the branch is new, none of the commits will be discovered on it (they're discovered in general, and likely discovered on other autoclose branches, but not discovered on this branch), so we'll parse all the way back to the root.

Instead, we want to stop when we hit commits that we've already discovered on //any// autoclose branch.

So do that.

Test Plan: Pushed a new branch, then pushed a new commit at HEAD. Ran discovery, verified we rediscovered only 1 commit, not every commit in history.

Reviewers: vrana, jungejason, aurelijus

Reviewed By: vrana

CC: aran

Maniphest Tasks: T1389

Differential Revision: https://secure.phabricator.com/D2798
Wrap Differential property changes
Add user.enable conduit method

Test Plan: enabled a disabled user

Reviewers: vrana, epriestley

Reviewed By: vrana

CC: aran, Korvin

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