Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Static Public Member Functions | Static Protected Attributes | List of all members
core_php_time_limit Class Reference

Utility class to manage PHP time limit. More...

Static Public Member Functions

static get_and_clear_unit_test_data ()
 For unit testing, returns an array of the values set during test. More...
 
static raise ($newlimit=0)
 Sets the PHP time limit to a number of seconds from now. More...
 

Static Protected Attributes

static int $currentend = -1
 Current end time of time limit (-1 if not set)
 
static array $unittestdata = array()
 Data for unit testing.
 

Detailed Description

Utility class to manage PHP time limit.

Member Function Documentation

◆ get_and_clear_unit_test_data()

static core_php_time_limit::get_and_clear_unit_test_data ( )
static

For unit testing, returns an array of the values set during test.

Return values
arrayArray of values set

◆ raise()

static core_php_time_limit::raise (   $newlimit = 0)
static

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.)

Parameters
int$newlimitLimit in seconds from now (0 = infinite)

The documentation for this class was generated from the following file: