ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCronStartUp Class Reference

Handles cron (cli) request. More...

+ Collaboration diagram for ilCronStartUp:

Public Member Functions

 __construct ($a_client_id, $a_login, $a_password)
 Constructor. More...
 
 initIlias ()
 Init ILIAS. More...
 
 authenticate ()
 Start authentication. More...
 
 logout ()
 Closes the current auth session. More...
 

Private Attributes

 $client = ''
 
 $username = ''
 
 $password = ''
 

Detailed Description

Handles cron (cli) request.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 11 of file class.ilCronStartUp.php.

Constructor & Destructor Documentation

◆ __construct()

ilCronStartUp::__construct (   $a_client_id,
  $a_login,
  $a_password 
)

Constructor.

Definition at line 20 of file class.ilCronStartUp.php.

21 {
22 $this->client = $a_client_id;
23 $this->username = $a_login;
24 $this->password = $a_password;
25 }

Member Function Documentation

◆ authenticate()

ilCronStartUp::authenticate ( )

Start authentication.

Returns
bool
Exceptions
ilCronExceptionif authentication failed.

Definition at line 50 of file class.ilCronStartUp.php.

51 {
52 include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendCredentials.php';
53 $credentials = new ilAuthFrontendCredentials();
54 $credentials->setUsername($this->username);
55 $credentials->setPassword($this->password);
56
57 include_once './Services/Authentication/classes/Provider/class.ilAuthProviderFactory.php';
58 $provider_factory = new ilAuthProviderFactory();
59 $providers = $provider_factory->getProviders($credentials);
60
61 include_once './Services/Authentication/classes/class.ilAuthStatus.php';
62 $status = ilAuthStatus::getInstance();
63
64 include_once './Services/Authentication/classes/Frontend/class.ilAuthFrontendFactory.php';
65 $frontend_factory = new ilAuthFrontendFactory();
66 $frontend_factory->setContext(ilAuthFrontendFactory::CONTEXT_CLI);
67 $frontend = $frontend_factory->getFrontend(
68 $GLOBALS['DIC']['ilAuthSession'],
69 $status,
70 $credentials,
71 $providers
72 );
73
74 $frontend->authenticate();
75
76 switch ($status->getStatus()) {
78 ilLoggerFactory::getLogger('auth')->debug('Authentication successful; Redirecting to starting page.');
79 return true;
80
81
82 default:
84 include_once './Services/Cron/exceptions/class.ilCronException.php';
85 throw new ilCronException($status->getTranslatedReason());
86 }
87 return true;
88 }
Factory for auth frontend classes.
static getInstance()
Get status instance.
const STATUS_AUTHENTICATION_FAILED
Standard cron exception.
static getLogger($a_component_id)
Get component logger.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS, ilAuthFrontendFactory\CONTEXT_CLI, ilAuthStatus\getInstance(), ilLoggerFactory\getLogger(), ilAuthStatus\STATUS_AUTHENTICATED, and ilAuthStatus\STATUS_AUTHENTICATION_FAILED.

+ Here is the call graph for this function:

◆ initIlias()

ilCronStartUp::initIlias ( )

Init ILIAS.

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

31 {
32 include_once './Services/Context/classes/class.ilContext.php';
34
35 // define client
36 // @see mantis 20371
37 $_GET['client_id'] = $this->client;
38
39 include_once './include/inc.header.php';
40 }
$_GET["client_id"]
const CONTEXT_CRON
static init($a_type)
Init context by type.

References $_GET, $client, ilContext\CONTEXT_CRON, and ilContext\init().

+ Here is the call graph for this function:

◆ logout()

ilCronStartUp::logout ( )

Closes the current auth session.

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

94 {
96 if (isset($GLOBALS['DIC']['ilAuthSession'])) {
97 $GLOBALS['DIC']['ilAuthSession']->logout();
98 }
99 }
const SESSION_CLOSE_USER
static setClosingContext($a_context)
set closing context (for statistics)

References $GLOBALS, ilSession\SESSION_CLOSE_USER, and ilSession\setClosingContext().

+ Here is the call graph for this function:

Field Documentation

◆ $client

ilCronStartUp::$client = ''
private

Definition at line 13 of file class.ilCronStartUp.php.

Referenced by initIlias().

◆ $password

ilCronStartUp::$password = ''
private

Definition at line 15 of file class.ilCronStartUp.php.

◆ $username

ilCronStartUp::$username = ''
private

Definition at line 14 of file class.ilCronStartUp.php.


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