CRM-14478 - Add generic API, "getrefcount"

For example: Before deciding whether to delete a RelationshipType, we can
call "RelationshipType.getrefcount" to see how many usages there are.

TODO: This counts references stored in standard SQL FK's, in dynamic SQL
FK's, and in option-value FK's.  It does not yet count references stored in
CiviCase XML.