Set the working directory when providing SSH / SFTP interfaces

Summary: Ref T1049.  Set the working directory when executing commands on Drydock hosts.  Without this set, they execute in the user's default home directory.

Test Plan: Ran a build and saw the correct working directory when running `pwd`.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: CanadianBadass, epriestley, Korvin

Maniphest Tasks: T1049

Differential Revision: https://secure.phabricator.com/D10293
Revert "Remove "Close Task" button"

This reverts commit d2ead465f38e659de77e8ba57cacd8a75b697f4c.
Allow Conduit to make tasks it can't edit
Allow customization of page view and application name on Login / Register

Summary:
This allows for customization of the PageView class and the displayed application name on the Login and Register pages, via two GET parameters, `__pageview` and `__appname`.

The use case for this is having users authenticating through a website that's built on the Phabricator infrastructure, where the page view used on the site doesn't match the default Phabricator style.  In order to ensure users don't get confused logging in (before we can explain why we use Phabricator for our backend), we set the __pageview and __appname variables when Nginx performs URL rewriting.

I realise this might be a pretty unusual use case, but I do think this is something that will eventually need to be tackled in the very long term when people might be using the Phabricator infrastructure for building web applications.  I don't know whether allowing the user to set `__pageview` is a security issue; you can only change it to page view classes that are already defined.

`__appname` is so that the pages can show "MyApp Registration" instead of "Phabricator Registration".

Test Plan: Viewed the `/auth/login` and `/auth/register` pages with `__pageview` and `__appname` set.

Reviewers: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D8642
Use omnipotent user for scanning existing child fragments
Allow users to choose what types of buildables they want to publish fragments for

Summary:
Supersedes D7750.

Essentially the same thing but on the new field infrastructure.  I did want to make this work for all steps while I was at it, but since the fields are now drawn from the step configuration, I'm not sure what the right way to go about this (should I modify the steps to include a call to the parent for "global fields"?  Or should I modify the build step edit to forcefully include the field there?)

Test Plan: Tested against combinations of commits and revisions

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T4884

Differential Revision: https://secure.phabricator.com/D8641
Allow Phabricator to redirect to Amazon S3 for file downloads

Summary: This allows users to configure Phabricator to redirect to Amazon S3 for file downloads.  This allows bandwidth costs to be mitigated to Amazon S3 and means that Phabricator doesn't need to download data from S3 to serve it back to the user.

Test Plan: Tested on https://code.redpointsoftware.com.au/.  Applied the patch, migrated all the file data, and played around with the configuration options (and tested both downloading files and requesting a Phragment list via getstate).

Reviewers: #blessed_reviewers, epriestley

Subscribers: joshuaspence, hach-que, epriestley, Korvin

Maniphest Tasks: T5479, T4884

Differential Revision: https://secure.phabricator.com/D8655
Support querying a specific snapshot on phragment.queryfragments

Summary: This allows a snapshot name to be specified when querying for Phragment fragments via Conduit.  It also adds the "size" field onto the reported results, which is the size of the file in bytes.

Test Plan: Specified snapshot, saw the data change.

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, hach-que

Maniphest Tasks: T5479, T4884

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

Conflicts:
	src/applications/phragment/conduit/PhragmentQueryFragmentsConduitAPIMethod.php
Add phragment.querysnapshots method

Summary: This adds a Conduit method to query the snapshots available on a given fragment.

Test Plan: Used it, it worked.

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, hach-que

Maniphest Tasks: T5479, T4884

Differential Revision: https://secure.phabricator.com/D8669
Create preceding paths for fragments

Summary: This fixes an issue where you are publishing a file in Harbormaster to a path like "path/to/new/fragment.txt", and the preceding directories don't yet exist.  This ensures that whenever a fragment is created, the preceding directories are also created.

Test Plan: Tested on my server and it worked.

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, hach-que

Maniphest Tasks: T5479, T4884

Differential Revision: https://secure.phabricator.com/D8671
Create file controller in Phragment

Summary:
This provides a controller similar to the ZIP controller, except that it's meant for us on fragments that you want to download as a file.  This controller provides a consistent URL (that can optionally contain a snapshot) which will be correct when and if a fragment gets updated, unlike the raw file link.

It also adds "Download Snapshot" on the snapshot controller, which links to the file controller with the snapshot name included.

Test Plan: Downloaded file-based fragments from the new controller.

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin, hach-que

Maniphest Tasks: T5479, T4884

Differential Revision: https://secure.phabricator.com/D8672
Prevent artifact key collision when builds are restarted

Summary: Ref T1049.  Because we no longer destroy artifacts when builds are restarted, we need the build generation number to be part of the artifact key, otherwise we get collisions when restarting builds that contain build steps that emit artifacts.

Test Plan: Ran it with a build plan of "Lease Host" and "Run Command", no longer got an artifact key crash.

Reviewers: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Maniphest Tasks: T1049

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