Added empty willSleep Method

Summary: Helps fix T2933

Test Plan: None required?

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2933

Differential Revision: https://secure.phabricator.com/D5651
Allow PHPFragmentLexer to parse terminal backslashes inside strings

Summary: Fixes T2944.

Test Plan: Unit tests.

Reviewers: nh, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2944

Differential Revision: https://secure.phabricator.com/D5653
Add a context-free grammar generator and a lipsum generator

Summary: See discussion in D5605. Add support for generating realistic-seeming test data.

Test Plan:
Generated lipsum:

Lorem laboris irure proident ut voluptate non ("Ipsum Lorem Dolor") minim aliqua ea anim nisi sunt. Ipsum ipsum consequat reprehenderit laborum anim commodo. Amet magna quis sed ("Dolor Dolor Lorem") minim quis laboris ea. Dolor laboris ut sit excepteur exercitation ("Lorem Dolor Sit") labore quis aliquip nisi.

Lorem lorem! Amet adipisicing ullamco duis enim in. Lorem excepteur aute officia ("Sit Lorem Ipsum") labore velit.

Amet proident minim elit dolor sit ("Sit Sit Sit") sed occaecat est. Sit officia.

Lorem voluptate eiusmod lorem amet aute esse ("Ipsum Dolor Sit") eu ea nisi eu. Lorem labore. Lorem dolore fugiat: excepteur, in, elit sunt. Amet lorem qui fugiat dolore! Lorem occaecat fugiat! Ipsum nisi eu: ex, ipsum, nostrud magna.

Dolor ad mollit minim sunt; lorem duis amet quis dolor. Amet culpa magna commodo irure: eu, esse, mollit anim. Dolor sint officia fugiat? Dolor anim. Dolor cillum nostrud fugiat qui ("Sit Sit Amet") tempor mollit. Ipsum amet voluptate magna labore!

Amet eu deserunt amet in. Dolor amet veniam sed aliqua ullamco sit. Amet ea sint aute nulla adipisicing, "Dolor et incididunt duis." Sit enim laborum proident elit ex. Dolor cupidatat; adipisicing irure irure ea consequat excepteur.

Ipsum sunt do amet aliqua aliqua culpa! Lorem dolore nostrud amet ut; nulla est deserunt officia ipsum. Sit ipsum. Lorem esse elit sit ut ex, "Ipsum reprehenderit labore duis fugiat sed." Ipsum sit non aute in; et est.

Sit ad nostrud consectetur esse anim! Ipsum magna aliqua ipsum consequat culpa aute. Ipsum ex sint nulla sit aliquip ("Amet Sit Amet") nulla. Lorem occaecat enim ipsum proident; irure officia sunt aliqua excepteur est.

Amet reprehenderit adipisicing et nisi et sed!

Ipsum enim aute deserunt adipisicing eu; do id laboris fugiat est. Lorem adipisicing. Lorem mollit tempor, "Amet amet magna." Amet laborum ut; culpa dolor sint.

Sit ipsum et laborum deserunt adipisicing. Sit do voluptate sint sint sunt aute, "Lorem proident non cupidatat non amet." Ipsum pariatur ad aliquip mollit aliqua ut: tempor, commodo, duis labore. Sit adipisicing quis duis et aliqua minim?

Sit et sint cupidatat est sint eiusmod?

Ipsum sint magna laborum magna duis; in officia sint in. Dolor labore. Lorem ex qui ea do commodo laborum. Amet dolore laborum tempor? Ipsum anim veniam nulla officia nisi esse; proident proident tempor cupidatat exercitation. Amet commodo quis mollit nisi lorem incididunt: non, exercitation, in laborum.

Ipsum irure veniam consectetur elit nostrud. Lorem non reprehenderit aute aliqua sed culpa: sed, nostrud, sit excepteur. Amet aute in elit laboris sed veniam? Lorem nisi reprehenderit nisi?

Reviewers: chad, vrana, AnhNhan

Reviewed By: chad

CC: aran

Differential Revision: https://secure.phabricator.com/D5606
Add a realname CFG

Summary: Pulled this mostly from Wikipedia while attempting not to be too racist or sexist.

Test Plan:
Alexander Taylor-Young
Aya Liu
Mahmoud "Ocelot" King
Noah Young
Emil McLewis
Esther Moore
Emil Clark
Jakub Williams
Youssef Zhao
Oliver Anderson-Allen
Victor Zhou
Mohamed Harris
Youssef Liu
Dylan "Apex" Thompson
Julia Li
Ahmed Marinez
Nathan Wu Li Shao
Emily Li
Noam Zhao
Noah Sun
Emily Williams
Mohamed Wilson
Santiago Robinson
Ahmed Zhao
Lucas Allen
Leon Davis
Marie McLiu
Nathan Li Wu Liu
Esther Lewis
Leon Anderson
Fatma McChen-O'Clark
Lucas Chen
Mustafa Brown
Julia Ma
Jack Lee
Madison Wang
Emma Marinez
Anya Jones

Reviewers: chad, AnhNhan

Reviewed By: AnhNhan

CC: aran

Differential Revision: https://secure.phabricator.com/D5608
Never self-close tags which can't self-close in phutil_tag()

Summary: Fixes T2955.

Test Plan: Unit tests.

Reviewers: chad, btrahan

Reviewed By: chad

CC: aran

Maniphest Tasks: T2955

Differential Revision: https://secure.phabricator.com/D5664
Add a method to identify running daemons in the process table

Summary: Ref T2374. Basically, sometimes we lose track of daemons and users get weird behaviors as a result. It's hard to figure out what's causing us to lose track of daemons since it rarely/never repros, but very easy to add some fallback code which does sanity checks against the process table. This should make the condition easy to understand/resolve until we eventually isolate and fix the pidfile stuff, or understand it better, or whatever.

Test Plan:
Ran the method and got reasonable output:

{F40173}

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2374

Differential Revision: https://secure.phabricator.com/D5663
Disable colon in cache key

Summary: I didn't find its usage outside tests.

Test Plan:
  $ arc unit

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5645
Make file caches more flexible

Summary:
  - Allow caller to set an acceptable lock wait time.
  - If we fail to lock and don't need to hold a lock for a write, just miss the cache.
  - See discussion in D5644.

Test Plan: I think I ran it? I'll actually check this in the next diff.

Reviewers: vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D5657
Allow phlog($a, $b)

Summary: Like `var_dump()`. I guess we would never want to embrace the `print_r()` signature?

Test Plan:
  phlog('It works!', 'a');

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5678
Adding CFG for PHP, C-like languages

Summary:
This produces only code that can never survive compile time nor lint/checkstyle.

badassery

Implemented common language traits for C-like languages (I don't consider language derivation, only the looks of code). I learnt today: PHP = C + `$` + Classes. I know I forgot many elementary structures like loops, and three-fourth of the OO stuff. Well, it's not like somebody's going to teach programming with this CFG.

I plan to add one or two other languages and make this reasonably generate diffable output (so we don't compare a function with a class).

Test Plan:
P791
P792
P793
Run away, Java: P794

Reviewers: epriestley, chad, btrahan, DeedyDas

Reviewed By: epriestley

CC: aran, Korvin

Maniphest Tasks: T2903

Differential Revision: https://secure.phabricator.com/D5685
Adding Java CFG

Summary: This one was pretty fast to do. My Java's really rusty though (there are lectures for that currently, but I'm not attending).

Test Plan: Generated plenty.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5692
Cleanup for CFGs

Summary: Removes unnecessary code. Also makes `applyRules` `protected` for `generateClass` and D5690

Test Plan: Generated lipsum, names, some code. Tried out `generateClass`.

Reviewers: epriestley, DeedyDas

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5695
Ceated a more flexible lipsum generator

Summary: Ref T2903

Test Plan: Generated lipsum of number of lines defined by the user.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin, AnhNhan

Maniphest Tasks: T2903

Differential Revision: https://secure.phabricator.com/D5690
use parse_url() for URI parsing

Summary:
We periodically have an issue with really long URLs hitting a
pcre backtracking limit (hhvm has a low limit configured due to historical
reasons).  Avoiding PCRE in the URL parser seems like a good idea.

Test Plan:
`arc unit` passes, but with the caveat that I've only run this
on hhvm so far; will arc patch it down to a mac shortly.  The concern is
whether parse_url groks svn+ssh and this may be PHP version dependent.

Reviewers: nh, epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5726
Allow libphutil libraries to load arbitrary runtime code from extensions/

Summary:
Currently, users need to build a libphutil library in order to add runtime code to Phabricator. While desirable for larger applications, this is fairly complex and offputting, and users have a relatively low success rate with it.

Instead, make libphutil recognize an `extensions/` directory and load arbitrary code from it at runtime, so that installs can drop code into this directory without needing to build a library.

(The tricky part here is that we update the class map so that `PhutilSymbolLoader` can select these classes correctly.)

Ref T2971.

Test Plan: Unit tests.

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran, AnhNhan

Maniphest Tasks: T2971

Differential Revision: https://secure.phabricator.com/D5714
Read only stdout in LinesOfALargeExecFuture

Summary:
We read all the output before throwing so stderr is empty.
I hit this issue in D5738.

Test Plan: Searched for invalid regexp in D5738.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D5767
Add a convenience method for instantiating concrete subclasses of some abstract ancestor

Summary: This pattern occurs fairly often in Phabricator; add a helper method.

Test Plan: Used in D5756.

Reviewers: btrahan, vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D5757
Parse hosts more strictly in `PhutilURI`

Summary: See some discussion in D5726.

Test Plan: Added new, passing test.

Reviewers: wez, btrahan

Reviewed By: wez

CC: aran

Differential Revision: https://secure.phabricator.com/D5797
Allow named links inside simple tables in Remarkup

Summary:
Fixes T3064. Currently, the simple table syntax sees the `|` in the middle of a named link as a cell divider.

Special-case this since I don't have a clean way of fixing it otherwise, but it seems reasonable to fix it.

Test Plan:
Added a passing test.

{F41831}

Reviewers: vrana, btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T3064

Differential Revision: https://secure.phabricator.com/D5798
Implement very basic PayPal API wrapper

Summary:
Ref T2787. The [[ https://github.com/paypal/merchant-sdk-php | official PayPal PHP SDK ]]:

  - ...is 27,000+ lines long!
  - ...is all generated code!
  - ...contains a non-ironic `PayPalAPIInterfaceServiceService` class as its primary interface!
  - ...uses SOAP!
  - ...is completely broken (literally missing most of the classes it needs to run)!

Instead, provide a minimal wrapper for the guts. The actual API is reasonable and there's a name-value pair flavor available.

I'm using this to implement the "Express Checkout" workflow in Phortune.

Test Plan: Made PayPal API calls using the test script.

Reviewers: btrahan, chad

Reviewed By: chad

CC: aran

Maniphest Tasks: T2787

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