- Issue created by @Rob230
- 🇬🇧United Kingdom Rob230
I tried making it load each user individually. It still ran out of memory. Then I added a call to
resetCache()
, because entities appear to be statically cached in PHP. This made it stop running out of memory, but it caused the installation of the module to take very long time. I suspect the time it took would be an issue for anyone enabling the module in the backend, rather than via the command line.Instead of doing this in an install hook, I think it should be done in a deploy hook, using a batch. The problem with that is I think deploy hooks are only available to people with drush.
The patch I'm attaching did work for me - it was able to install the module successfully without running out of memory, but it took over 5 minutes (with drush), so I suspect if you enabled the module in the backend it would cause a 504 error (gateway timeout) or hit PHP's max_execution_time for most common server set ups.