ILIAS
release_9 Revision v9.13-25-g2c18ec4c24f
◀ ilDoc Overview
InitCtrlService.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
use
ILIAS\DI\Container
;
22
use
ILIAS\Services\Help\ScreenId\HelpScreenIdObserver
;
23
31
final
class
InitCtrlService
32
{
40
public
function
init
(
Container
$dic
): void
41
{
42
$this->
abortIfMissingDependencies
($dic);
43
$ilias_path = dirname(__FILE__, 5) .
'/'
;
44
45
try
{
46
$ctrl_structure =
new
ilCtrlStructure
(
47
require $ilias_path .
ilCtrlStructureArtifactObjective::ARTIFACT_PATH
,
48
require $ilias_path .
ilCtrlBaseClassArtifactObjective::ARTIFACT_PATH
,
49
require $ilias_path .
ilCtrlSecurityArtifactObjective::ARTIFACT_PATH
50
);
51
}
catch
(
Throwable
$t) {
52
throw
new
ilCtrlException
(self::class .
" could not require artifacts, try `composer du` first."
);
53
}
54
55
$token_repository =
new
ilCtrlTokenRepository
();
56
$path_factory =
new
ilCtrlPathFactory
($ctrl_structure);
57
$context
=
new
ilCtrlContext
(
58
$path_factory,
59
$dic->
http
()->wrapper()->query(),
60
$dic->
refinery
()
61
);
62
63
// create global instance of ilCtrl
64
$GLOBALS
[
'ilCtrl'
] =
new
ilCtrl
(
65
$ctrl_structure,
66
$token_repository,
67
$path_factory,
68
$context
,
69
$dic[
"http.response_sender_strategy"
],
70
$dic->
http
()->request(),
71
$dic->
http
()->wrapper()->post(),
72
$dic->
http
()->wrapper()->query(),
73
$dic->
refinery
(),
74
$dic[
"component.factory"
],
75
new
ilCtrlSubject
(),
76
new
ilCtrlQueryRegexParser
(),
77
);
78
79
// add helper function to DI container that
80
// returns the global instance.
81
$dic[
'ilCtrl'
] =
static
function
() {
82
return
$GLOBALS[
'ilCtrl'
];
83
};
84
}
85
93
private
function
abortIfMissingDependencies
(
Container
$dic
): void
94
{
95
if
(!$dic->offsetExists(
'http'
)) {
96
throw
new
ilCtrlException
(
"Cannot initialize ilCtrl if HTTP Services are not yet available."
);
97
}
98
99
if
(!$dic->offsetExists(
'refinery'
)) {
100
throw
new
ilCtrlException
(
"Cannot initialize ilCtrl if Refinery Factory is not yet available."
);
101
}
102
103
// if (!$dic->offsetExists('ilDB')) {
104
// throw new ilCtrlException("Cannot initialize ilCtrl if Database is not yet available.");
105
// }
106
}
107
}
ilCtrlBaseClassArtifactObjective\ARTIFACT_PATH
const ARTIFACT_PATH
Definition:
class.ilCtrlBaseClassArtifactObjective.php:22
$context
$context
Definition:
webdav.php:31
ILIAS\DI\Container\http
http()
Definition:
Container.php:173
InitCtrlService
Class InitCtrlService wraps the initialization of ilCtrl.
Definition:
InitCtrlService.php:31
ilCtrlSubject
Definition:
class.ilCtrlSubject.php:26
ilCtrlPathFactory
Class ilCtrlPathFactory.
Definition:
class.ilCtrlPathFactory.php:12
ilCtrlContext
Class ilCtrlContext is responsible for holding the current context information.
Definition:
class.ilCtrlContext.php:30
ilCtrlStructure
Class ilCtrlStructure holds the currently read control structure.
Definition:
class.ilCtrlStructure.php:12
InitCtrlService\init
init(Container $dic)
Initializes the ilCtrl service.
Definition:
InitCtrlService.php:40
ILIAS\DI\Container
Customizing of pimple-DIC for ILIAS.
Definition:
Container.php:35
Container
ILIAS\DI\Container\refinery
refinery()
Definition:
Container.php:248
ilCtrlSecurityArtifactObjective\ARTIFACT_PATH
const ARTIFACT_PATH
Definition:
class.ilCtrlSecurityArtifactObjective.php:24
$GLOBALS
$GLOBALS["DIC"]
Definition:
wac.php:31
ilCtrlStructureArtifactObjective\ARTIFACT_PATH
const ARTIFACT_PATH
Definition:
class.ilCtrlStructureArtifactObjective.php:22
ilCtrlTokenRepository
Class ilCtrlTokenRepository.
Definition:
class.ilCtrlTokenRepository.php:12
HelpScreenIdObserver
InitCtrlService\abortIfMissingDependencies
abortIfMissingDependencies(Container $dic)
Aborts if another dependency required by the ctrl service is not yet available.
Definition:
InitCtrlService.php:93
ilCtrlException
ilCtrl exceptions
Definition:
class.ilCtrlException.php:10
ilCtrlQueryRegexParser
Definition:
class.ilCtrlQueryRegexParser.php:24
$dic
$dic
Definition:
result.php:32
ilCtrl
Throwable
Services
Init
classes
Dependencies
InitCtrlService.php
Generated on Wed Sep 10 2025 14:11:30 for ILIAS by
1.8.13 (using
Doxyfile
)