Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRM-20541 - Use drupal_static() instead of static #447

Merged
merged 1 commit into from
Jul 10, 2017

Conversation

totten
Copy link
Member

@totten totten commented May 18, 2017

The impetus behind CRM-20541 seems to be a testing scenario where the
setup/teardown process resets Civi (Civi::reset()) without resetting
Drupal (drupal_static_reset()). IMHO, it's better to keep the systems
aligned by either (a) resetting both or (b) resetting neither.

For the situation where you reset both, the state within
civicrm_initialize() needs some way to reset. This function executes
within a Drupal context (before Civi has booted), so it should obey the
reset conventions for Drupal -- i.e. use drupal_static().

Ping @eileenmcnaughton


The impetus behind CRM-20541 seems to be a testing scenario where the
setup/teardown process resets Civi (`Civi::reset()`) without resetting
Drupal (`drupal_static_reset()`).  IMHO, it's better to keep the systems
aligned by either (a) resetting both or (b) resetting neither.

For the situation where you reset both, the state within
`civicrm_initialize()` needs some way to reset.  This function executes
within a Drupal context (before Civi has booted), so it should obey the
reset conventions for Drupal -- i.e.  use `drupal_static()`.
@totten totten force-pushed the 7.x-master-20541 branch from 51678c3 to 9a6cd1b Compare May 18, 2017 20:02
@jackrabbithanna
Copy link
Contributor

I think this seems like real good idea. If you are using CiviCRM Entity, its a heavy user of civicrm_initialize() and things could be happening during cron, in drush, all kinds of processing before and after page loads. Who knows what never before seen conditions could crop up. Better that is in the management of the Drupal static system.

@jackrabbithanna
Copy link
Contributor

I've patched my local dev instance where I'm working on CiviCRM Entity stuff, and I'll watch and see if anything seems to go amiss. So far works fine (4.6 though), but shouldn't matter really in this case I don't think.

@eileenmcnaughton
Copy link
Contributor

I'm going to merge this - not yet sure if it solves all the test issues I'm having, but I'm pretty sure this is more correct and I don't believe there is any risk with it.

@eileenmcnaughton eileenmcnaughton merged commit f7ed137 into civicrm:7.x-master Jul 10, 2017
@totten totten deleted the 7.x-master-20541 branch July 10, 2017 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants