ILIAS  release_8 Revision v8.24
ilRuntime Class Reference
+ Collaboration diagram for ilRuntime:

Public Member Functions

 isHHVM ()
 
 isPHP ()
 
 isFPM ()
 
 getVersion ()
 
 getName ()
 
 __toString ()
 
 getReportedErrorLevels ()
 
 shouldLogErrors ()
 
 shouldDisplayErrors ()
 
 getBinary ()
 

Static Public Member Functions

static getInstance ()
 

Private Member Functions

 __construct ()
 The runtime is a constant state during one request, so please use the public static getInstance() to instantiate the runtime. More...
 

Static Private Attributes

static self $instance = null
 

Detailed Description

Definition at line 26 of file class.ilRuntime.php.

Constructor & Destructor Documentation

◆ __construct()

ilRuntime::__construct ( )
private

The runtime is a constant state during one request, so please use the public static getInstance() to instantiate the runtime.

Definition at line 33 of file class.ilRuntime.php.

34 {
35 }

Member Function Documentation

◆ __toString()

ilRuntime::__toString ( )

Definition at line 79 of file class.ilRuntime.php.

79 : string
80 {
81 return $this->getName() . ' ' . $this->getVersion();
82 }

References getName(), and getVersion().

+ Here is the call graph for this function:

◆ getBinary()

ilRuntime::getBinary ( )

Definition at line 111 of file class.ilRuntime.php.

111 : string
112 {
113 if (defined('PHP_BINARY') && PHP_BINARY !== '') {
114 return escapeshellarg(PHP_BINARY);
115 }
116
117 $possibleBinaryLocations = [
118 PHP_BINDIR . '/php',
119 PHP_BINDIR . '/php-cli.exe',
120 PHP_BINDIR . '/php.exe',
121 ];
122
123 foreach ($possibleBinaryLocations as $binary) {
124 if (is_readable($binary)) {
125 return escapeshellarg($binary);
126 }
127 }
128
129 return 'php';
130 }

◆ getInstance()

static ilRuntime::getInstance ( )
static

Definition at line 37 of file class.ilRuntime.php.

37 : self
38 {
39 if (self::$instance === null) {
40 self::$instance = new self();
41 }
42
43 return self::$instance;
44 }
static self $instance

References $instance.

Referenced by ILIAS\FileDelivery\Delivery\detemineDeliveryType(), ilErrorHandling\getIlRuntime(), ilApc\getMemoryLimit(), RunTimeTest\testBinaryCanBeRetrieved(), RunTimeTest\testGetNameReturnsPhpWhenRunningOnPhp(), and RunTimeTest\testGetVersionReturnsPhpVersionWhenRunningPhp().

+ Here is the caller graph for this function:

◆ getName()

ilRuntime::getName ( )

Definition at line 70 of file class.ilRuntime.php.

70 : string
71 {
72 if ($this->isHHVM()) {
73 return 'HHVM';
74 }
75
76 return 'PHP';
77 }

References isHHVM().

Referenced by __toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getReportedErrorLevels()

ilRuntime::getReportedErrorLevels ( )

Definition at line 84 of file class.ilRuntime.php.

84 : int
85 {
86 if ($this->isHHVM()) {
87 return (int) ini_get('hhvm.log.runtime_error_reporting_level');
88 }
89
90 return (int) ini_get('error_reporting');
91 }

References isHHVM().

+ Here is the call graph for this function:

◆ getVersion()

ilRuntime::getVersion ( )

Definition at line 61 of file class.ilRuntime.php.

61 : string
62 {
63 if ($this->isHHVM()) {
64 return HHVM_VERSION;
65 }
66
67 return PHP_VERSION;
68 }

References isHHVM().

Referenced by __toString().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFPM()

ilRuntime::isFPM ( )

Definition at line 56 of file class.ilRuntime.php.

56 : bool
57 {
58 return PHP_SAPI === 'fpm-fcgi';
59 }

◆ isHHVM()

ilRuntime::isHHVM ( )

Definition at line 46 of file class.ilRuntime.php.

46 : bool
47 {
48 return defined('HHVM_VERSION');
49 }

Referenced by getName(), getReportedErrorLevels(), getVersion(), isPHP(), shouldDisplayErrors(), and shouldLogErrors().

+ Here is the caller graph for this function:

◆ isPHP()

ilRuntime::isPHP ( )

Definition at line 51 of file class.ilRuntime.php.

51 : bool
52 {
53 return !$this->isHHVM();
54 }

References isHHVM().

+ Here is the call graph for this function:

◆ shouldDisplayErrors()

ilRuntime::shouldDisplayErrors ( )

Definition at line 102 of file class.ilRuntime.php.

102 : bool
103 {
104 if ($this->isHHVM()) {
105 return (bool) ini_get('hhvm.debug.server_error_message');
106 }
107
108 return (bool) ini_get('display_errors');
109 }

References isHHVM().

+ Here is the call graph for this function:

◆ shouldLogErrors()

ilRuntime::shouldLogErrors ( )

Definition at line 93 of file class.ilRuntime.php.

93 : bool
94 {
95 if ($this->isHHVM()) {
96 return (bool) ini_get('hhvm.log.use_log_file');
97 }
98
99 return (bool) ini_get('log_errors');
100 }

References isHHVM().

+ Here is the call graph for this function:

Field Documentation

◆ $instance

self ilRuntime::$instance = null
staticprivate

Definition at line 28 of file class.ilRuntime.php.

Referenced by getInstance().


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