Civi::paths() - Decouple settings from paths. Allow path vars.
authorTim Otten <totten@civicrm.org>
Tue, 15 Sep 2015 22:58:17 +0000 (15:58 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 17 Sep 2015 22:49:32 +0000 (15:49 -0700)
commite3d28c747e2da24292705080ccc84f29e2b44f12
tree28e882984f59092566aef577b373406dec1bdae1
parent90777b73c3a04e023c36417abf3b4ab7a282dfb9
Civi::paths() - Decouple settings from paths. Allow path vars.

There has been a policy underwhich paths and URLs are assumed to be relative
to different points (urls => webroot; paths => sites/*/files/civicrm).  For
some settings, this is fairly confusing.  The policy had been encoded in
`SettingsBag::getPath` and `SettingsBag::getUrl`.  It's particularly
confusing because (sometimes) the default value of a specific property isn't
really aligned with the policy.

This revision attempts to cleanup in two ways:

 1. It removes policy from `SettingsBag` and puts it in `Civi\Core\Paths`.
 2. It makes the policy less important by allowing variables in the paths.
   * `[civicrm.files]/upload` might evaluate to `/var/www/sites/default/files/civicrm/upload`
   * `[cms.root]/myuploads` might evaluate to `/var/www/myuploads`

The revision also updates MagicMerge to store various path and URL policies
in `getPropertyMap()` rather than adhoc callbacks.
CRM/Core/Config/Defaults.php
CRM/Core/Config/MagicMerge.php
CRM/Core/Config/Runtime.php
CRM/Utils/File.php
CRM/Utils/Rule.php
Civi.php
Civi/Core/Paths.php [new file with mode: 0644]
Civi/Core/SettingsBag.php
tests/phpunit/Civi/Core/SettingsManagerTest.php