ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilSessionMaxIdleIsSetObjective Class Reference
+ Inheritance diagram for ilSessionMaxIdleIsSetObjective:
+ Collaboration diagram for ilSessionMaxIdleIsSetObjective:

Public Member Functions

 __construct (protected Setup\Config $config)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Setup\Environment $environment)
 

Private Member Functions

 generateServerInfoFile (string $filename, string $token)
 
 getCurlConnection (ilSetting $settings, string $url, ?string $token=null)
 
 getPHPIniValuesByFileGetContents (string $url, ?string $token=null)
 
 infoNoConnection (Setup\CLI\IOWrapper $io)
 

Detailed Description

Definition at line 23 of file class.ilSessionMaxIdleIsSetObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilSessionMaxIdleIsSetObjective::__construct ( protected Setup\Config  $config)

Definition at line 25 of file class.ilSessionMaxIdleIsSetObjective.php.

27 {
28 }

Member Function Documentation

◆ generateServerInfoFile()

ilSessionMaxIdleIsSetObjective::generateServerInfoFile ( string  $filename,
string  $token 
)
private

Definition at line 179 of file class.ilSessionMaxIdleIsSetObjective.php.

179 : void
180 {
181 $content = <<<TEXT
182<?php
183if (!isset(\$_GET['token'])) {
184 return "";
185}
186
187if (\$_GET['token'] !== "$token") {
188 return "";
189}
190
191\$scl = ini_get('session.cookie_lifetime');
192\$smlt = ini_get('session.gc_maxlifetime');
193
194echo \$scl . "&" . \$smlt;
195TEXT;
196
197 file_put_contents("public/$filename", $content);
198 }
$_GET['cmd']
Definition: lti.php:26

References $_GET.

◆ getCurlConnection()

ilSessionMaxIdleIsSetObjective::getCurlConnection ( ilSetting  $settings,
string  $url,
?string  $token = null 
)
private
Exceptions
ilCurlConnectionException

Definition at line 203 of file class.ilSessionMaxIdleIsSetObjective.php.

204 {
205 if ($token !== null) {
206 $url .= '?token=' . $token;
207 }
208
209 $curl = new ilCurlConnection(
210 $url,
211 new ilProxySettings($settings)
212 );
213 $curl->init();
214 $curl->setOpt(CURLOPT_SSL_VERIFYPEER, 0);
215 $curl->setOpt(CURLOPT_SSL_VERIFYHOST, 0);
216 $curl->setOpt(CURLOPT_RETURNTRANSFER, 1);
217 $curl->setOpt(CURLOPT_FOLLOWLOCATION, 1);
218 $curl->setOpt(CURLOPT_MAXREDIRS, 1);
219
220 return $curl;
221 }
class ilProxySettings
$url
Definition: shib_logout.php:68
$token
Definition: xapitoken.php:70

References $token, and $url.

◆ getHash()

ilSessionMaxIdleIsSetObjective::getHash ( )

Definition at line 30 of file class.ilSessionMaxIdleIsSetObjective.php.

30 : string
31 {
32 return hash('sha256', self::class);
33 }

◆ getLabel()

ilSessionMaxIdleIsSetObjective::getLabel ( )

Definition at line 35 of file class.ilSessionMaxIdleIsSetObjective.php.

35 : string
36 {
37 return "Ensures 'session_max_idle' is set properly";
38 }

◆ getPHPIniValuesByFileGetContents()

ilSessionMaxIdleIsSetObjective::getPHPIniValuesByFileGetContents ( string  $url,
?string  $token = null 
)
private
Exceptions
ErrorException

Definition at line 226 of file class.ilSessionMaxIdleIsSetObjective.php.

226 : string
227 {
228 set_error_handler(static function (int $severity, string $message, string $file, int $line): never {
229 throw new ErrorException($message, $severity, $severity, $file, $line);
230 });
231
232 if ($token !== null) {
233 $url .= '?token=' . $token;
234 }
235
236 try {
237 return file_get_contents($url);
238 } catch (ErrorException $e) {
239 restore_error_handler();
240 throw $e;
241 }
242 }
$message
Definition: xapiexit.php:31

References Vendor\Package\$e, $message, $token, and $url.

◆ getPreconditions()

ilSessionMaxIdleIsSetObjective::getPreconditions ( Setup\Environment  $environment)

◆ infoNoConnection()

ilSessionMaxIdleIsSetObjective::infoNoConnection ( Setup\CLI\IOWrapper  $io)
private

Definition at line 244 of file class.ilSessionMaxIdleIsSetObjective.php.

244 : void
245 {
246 $message =
247 "ilSessionMaxIdleIsSetObjective:\n" .
248 "Cannot establish proper connection to webserver.\n" .
249 "In the event of an installation the value for session expire\n" .
250 "will be the default value.\n" .
251 "In the event of an update, the current value for session expire\n" .
252 'is retained.'
253 ;
254
255 $io->inform($message);
256 }

References $message.

◆ isNotable()

ilSessionMaxIdleIsSetObjective::isNotable ( )

Definition at line 40 of file class.ilSessionMaxIdleIsSetObjective.php.

40 : bool
41 {
42 return true;
43 }

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