MediaWiki  1.23.14
ScopedPHPTimeout Class Reference

Class to expand PHP execution time for a function call. More...

Public Member Functions

 __construct ( $seconds)
 
 __destruct ()
 Restore the original timeout. More...
 

Public Attributes

const MAX_TOTAL_CALLS = 1000000
 
const MAX_TOTAL_TIME = 300
 

Protected Attributes

 $oldIgnoreAbort
 
 $oldTimeout
 
 $startTime
 

Static Protected Attributes

static $stackDepth = 0
 
static $totalCalls = 0
 
static $totalElapsed = 0
 

Detailed Description

Class to expand PHP execution time for a function call.

Use this when performing changes that should not be interrupted.

On construction, set_time_limit() is called and set to $seconds. If the client aborts the connection, PHP will continue to run. When the object goes out of scope, the timer is restarted, with the original time limit minus the time the object existed.

Definition at line 32 of file ScopedPHPTimeout.php.

Constructor & Destructor Documentation

◆ __construct()

ScopedPHPTimeout::__construct (   $seconds)
Parameters
$secondsinteger

Definition at line 48 of file ScopedPHPTimeout.php.

References $stackDepth, and $totalCalls.

◆ __destruct()

ScopedPHPTimeout::__destruct ( )

Restore the original timeout.

This does not account for the timer value on __construct().

Definition at line 70 of file ScopedPHPTimeout.php.

References $stackDepth, and $startTime.

Member Data Documentation

◆ $oldIgnoreAbort

ScopedPHPTimeout::$oldIgnoreAbort
protected

Definition at line 35 of file ScopedPHPTimeout.php.

◆ $oldTimeout

ScopedPHPTimeout::$oldTimeout
protected

Definition at line 34 of file ScopedPHPTimeout.php.

◆ $stackDepth

ScopedPHPTimeout::$stackDepth = 0
staticprotected

Definition at line 37 of file ScopedPHPTimeout.php.

Referenced by __construct(), and __destruct().

◆ $startTime

ScopedPHPTimeout::$startTime
protected

Definition at line 33 of file ScopedPHPTimeout.php.

Referenced by __destruct().

◆ $totalCalls

ScopedPHPTimeout::$totalCalls = 0
staticprotected

Definition at line 38 of file ScopedPHPTimeout.php.

Referenced by __construct().

◆ $totalElapsed

ScopedPHPTimeout::$totalElapsed = 0
staticprotected

Definition at line 39 of file ScopedPHPTimeout.php.

◆ MAX_TOTAL_CALLS

const ScopedPHPTimeout::MAX_TOTAL_CALLS = 1000000

Definition at line 42 of file ScopedPHPTimeout.php.

◆ MAX_TOTAL_TIME

const ScopedPHPTimeout::MAX_TOTAL_TIME = 300

Definition at line 43 of file ScopedPHPTimeout.php.


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