More refined backport of CRM.API
Merge branch '4.2-d7' of ssh://git@github.com/fuzionnz/civicrm.git into 4.2-d7