Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.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