General developer forum

Raising and lowering memory

 
Picture of Kimber Warden
Raising and lowering memory
Particularly helpful Moodlers

I'm writing a new enrolment plug-in based on the database enrolment plugin. I may or may not keep the calls:

  • core_php_time_limit::raise();
  • raise_memory_limit(MEMORY_HUGE);

If I keep them, do I need to restore them to their original values after my scheduled task is complete? Or does that happen automatically? If I need to restore the original values, how do I do that without setting them to an explicit value? 

 
Average of ratings: -
Picture of Darko Miletić
Re: Raising and lowering memory
Core developersParticularly helpful Moodlers

Both those methods affect dynamically the php settings thus altering whatever is set in the php.ini. However those changes go away once the script finishes it's task so just leave it as is. No cleanup is required.

 
Average of ratings: Useful (1)