ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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.

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

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())
77  {
79  ilLoggerFactory::getLogger('auth')->debug('Authentication successful; Redirecting to starting page.');
80  return true;
81 
82 
83  default:
85  include_once './Services/Cron/exceptions/class.ilCronException.php';
86  throw new ilCronException($status->getTranslatedReason());
87  }
88  return true;
89  }
Standard cron exception.
const STATUS_AUTHENTICATION_FAILED
Factory for auth frontend classes.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static getInstance()
Get status instance.
static getLogger($a_component_id)
Get component logger.
+ Here is the call graph for this function:

◆ initIlias()

ilCronStartUp::initIlias ( )

Init ILIAS.

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

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

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.
+ Here is the call graph for this function:

◆ logout()

ilCronStartUp::logout ( )

Closes the current auth session.

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

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

95  {
97  $GLOBALS['DIC']['ilAuthSession']->logout();
98  }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
const SESSION_CLOSE_USER
static setClosingContext($a_context)
set closing context (for statistics)
+ 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: