dev/core#1674 - Update container cache when folder is removed or created
authorTim Otten <totten@civicrm.org>
Wed, 1 Apr 2020 08:00:07 +0000 (01:00 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 1 Apr 2020 08:14:00 +0000 (01:14 -0700)
commit5f16ea7b5b1d4edcd4be21bf7963dafead9686ea
treea2b905bc6a66146fc355841201a1f543146dc035
parent61d72c88752a3fa91447d2a44ff563b2c4c1c11d
dev/core#1674 - Update container cache when folder is removed or created

Conceptually, you want to:

* (A) Keep the container cache when nothing has changed (regardless of whether that status-quo has an API4 subscriber folder).
* (B) Update the cache if Civi/Api4/Event/Subscriber/*.php has been newly created
* (C) Update the cache if Civi/Api4/Event/Subscriber/*.php has been newly removed

To test this out, I hacked `Civi\Core\Container::loadContainer()` to emit a debug message
to indicate if it is reusing the cache or updating. Then, I prepared two terminals for running alternate steps:

* In terminal 1, go back and forth with adding/removing folders/files like `Civi/Api4/Event/Subscriber`.
* In terminal 2, periodically run `cv ev 'echo "Hello\n";'` and note whether the cache is update.

In this way, we can see if a developer action (adding a file) leads to an automatic update in the cache.

I found that the previous commit fixed (A) and did (C), but it failed to
update per (B).  This commit should handle (A), (B), and (C).
CRM/Api4/Services.php