generateFileHash() and validateFileHash() should be colocated
authorTim Otten <totten@civicrm.org>
Tue, 12 Feb 2019 23:50:40 +0000 (15:50 -0800)
committerTim Otten <totten@civicrm.org>
Thu, 21 Feb 2019 03:42:19 +0000 (19:42 -0800)
commit76edc327d4f5d1be70a6cc26ec04d0b52b6cf4c8
tree24134c790f6d37164cc09e9418143e3f6d7f91d8
parenta5b71671c558ce8ad24f20138a9d8bc1cca85198
generateFileHash() and validateFileHash() should be colocated

The two functions (`generateFileHash()` and `validateFileHash()`) are
tightly-coupled.  Most changes to one would require a matching change in the
other.  So they should be parallel.

It'd be OK to say "the hash formula is a general utility for any party using
file APIs" (so put `generateFileHash()` and `validateFileHash()` in `CRM_Core_BAO_File`).

It'd be OK to say "the hash formula is specific to the end-point/page which
serves files" (so put `generateFileHash()` and `validateFileHash()` in
`CRM_Core_Page_File`).

The former feels a bit more accurate, so I pushed it toward that.
CRM/Core/BAO/File.php
CRM/Core/Page/File.php
tests/phpunit/api/v3/AttachmentTest.php