Support SIGINT for graceful daemon shutdown in libphutil

Summary: Ref T5855. Makes SIGINT mean "graceful shutdown" instead of being a synonym of SIGTERM.

Test Plan: See next revision.

Reviewers: btrahan, hach-que

Reviewed By: hach-que

Subscribers: epriestley

Maniphest Tasks: T5855

Differential Revision: https://secure.phabricator.com/D10227
Allow PhutilCommandString to escape as Powershell

Summary: This allows PhutilCommandString to escape as Powershell.

Test Plan: Unit tests

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D10249
Work around OSX after Yosemite no longer respecting CURLOPT_CAINFO

Summary: Fixes T5913. See discussion in that task.

Test Plan: Will make affected users in T5913 test.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: ide, epriestley

Maniphest Tasks: T5913

Differential Revision: https://secure.phabricator.com/D10315
Make sure TempFiles are destroyed after a PHP fatal error

Summary: Fixes T4284. Object destructors are not called after a fatal, but shutdown functions are.

Test Plan:
  - Created a test script which makes a temp file, then fatals.
  - Before patch, temp file was left around.
  - After patch, it is cleaned up.
  - Explicitly destroyed the tempfile in the script to verify that double-destruction is fine.
  - Removed fatal to verify that normal behavior works as expected.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T4284

Differential Revision: https://secure.phabricator.com/D10329
Daemons - add phd-daemon support for findRunningDaemons

Summary: Ref T2374.

Test Plan: D10354 now works...!

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T2374

Differential Revision: https://secure.phabricator.com/D10357
phutil_utf8_shorten => PhutilUTF8StringTruncator

Summary: Fixes T3307. Clean up the remaining instances and delete the actual function

Test Plan: arc lintypoo

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T3307

Differential Revision: https://secure.phabricator.com/D10390
Highlight numbers in Python import names properly

Summary: This was a typo I made when porting the Pygments lexer.

Test Plan: Made a paste with "import webapp2_extras" and saw that the whole "webapp2_extras" was blue (unlike before, when only "webapp" was).

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10418
Rename base MySQL database connection class

Summary: Ref T5655. Rename `AphrontMySQLDatabaseConnectionBase` to `AphrontBaseMySQLDatabaseConnection` for consistency.

Test Plan: N/A

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5655

Differential Revision: https://secure.phabricator.com/D10148
Apply some autofix linter rules

Summary: Self explanatory.

Test Plan: Ran `arc lint --everything --apply-patches` essentially.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10432
Update the `JSONLint` API

Summary:
Update the [[https://github.com/Seldaek/jsonlint/ | JSONLint]] external to more closely resemble the upstream. {D9623} patched the library to return an `array` instead of `stdClass`, however this functionality now exists upstream as an optional mode (see [[https://github.com/Seldaek/jsonlint/commit/351e4350171d9c3af292cfb524dd83badb283e62 | 351e4350171d9c3af292cfb524dd83badb283e62]]).

I basically copied the external verbatim and then applied a sequence of patches (the initial patches required for D9622, plus D9633).

Test Plan: Ran unit tests.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10433
Add some additional PHP extensions to the compatibility map

Summary: Because why not?

Test Plan: Eyeball it.

Reviewers: btrahan, #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10436
Patch the `JSONLint` external to be compatible with PHP 5.2

Summary: The [[https://github.com/Seldaek/jsonlint/ | JSONLint]] external utilizes the shorthand ternary (`?:`) syntax, which is only available from PHP 5.3. Expand the shorthand ternary form into ordinary ternary form to ensure compatibility with PHP 5.2. Depends on D10433.

Test Plan: Not sure how...

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10435
Fix typo in method call

Summary: See D10435.

Auditors: joshuaspence
Minor fix for JSONLint

Summary: In D10435, the [[https://github.com/Seldaek/jsonlint/ | JSONLint]] external was patched in an attempt to ensure PHP 5.2 compatibility. The fact that `$this->lexer->lex()` will produce a different token if invoked a second time was overlooked.

Test Plan: Ran `./bin/arc lint -- src/lint/linter` in rARC.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10448
Apply some autofix linter rules

Summary: Self-explanatory.

Test Plan: Eyeball it.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10452
Support "tel:" protocol in Remarkup

Summary: Fixes T6057.

Test Plan: Added and executed unit tests.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6057

Differential Revision: https://secure.phabricator.com/D10449
Parse unusual editor URIs with no domain in the way users expect

Summary:
Fixes T6106. See that task for additional dicussion. Specific issue is that if a URI has no path, but does contain a "/" in the query string, `parse_url()` does something unexpected.

```
$ php -r "var_dump(parse_url('idea://open?a=/'));"
array(3) {
  ["scheme"]=>
  string(4) "idea"
  ["host"]=>
  string(7) "open?a="
  ["path"]=>
  string(1) "/"
```

Instead, adjust these URIs so we get a more expected result.

Test Plan: Added failing unit tests and made them pass.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T6106

Differential Revision: https://secure.phabricator.com/D10515
Add a `getEndLineNumber` method to the `AASTNode` class

Summary: Adds a `getEndLineNumber` method to the `AASTNode` class. This method supplements the `getLineNumber` method, providing the //ending// line number for a given node.  This feels a little awkward, but it makes D10535 a little nicer.

Test Plan: See D10535.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10534
Update AWS API version

Summary: This updates the AWS API date to a newer version, which means AWS will expose more functionality in responses and requests to their REST API.

Test Plan: Encountered a problem where properties weren't available in the response during Drydock EC2 allocation because of this old version; updated this version and the properties started appearing.

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D10545
Add a few methods to `AASTNode` and `AASTToken`

Summary: Add a few general purpose methods to the `AASTNode` and `AASTToken` class.

Test Plan: See D10558.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: epriestley, Korvin

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