Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

PHP time limit management.

Copyright: 2013 The Open University
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 113 lines (4 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

core_php_time_limit:: (2 methods):
  raise()
  get_and_clear_unit_test_data()


Class: core_php_time_limit  - X-Ref

Utility class to manage PHP time limit.

raise($newlimit = 0)   X-Ref
Sets the PHP time limit to a number of seconds from now.

This function will always extend the time limit (in other words, if the time
limit has already been set further in the future, it will do nothing).

In order to support front-end servers which may time out silently if no
output is displayed, you should ideally only call this function if you expect
some output to be displayed at the same time. (I.e. if you call this function
each time around a loop, also display some output each time around the loop,
such as a progress bar update.)

param: int $newlimit Limit in seconds from now (0 = infinite)

get_and_clear_unit_test_data()   X-Ref
For unit testing, returns an array of the values set during test.

return: array Array of values set