ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
InitResourceStorage Class Reference

Responsible for loading the Resource Storage into the dependency injection container of ILIAS. More...

+ Collaboration diagram for InitResourceStorage:

Public Member Functions

 getResourceBuilder (\ILIAS\DI\Container $c)
 
 getFlavourBuilder (\ILIAS\DI\Container $c)
 
 init (\ILIAS\DI\Container $c)
 

Data Fields

const D_SERVICE = 'resource_storage'
 
const D_REPOSITORIES = self::D_SERVICE . '.repositories'
 
const D_STORAGE_HANDLERS = self::D_SERVICE . '.storage_handlers'
 
const D_RESOURCE_BUILDER = self::D_SERVICE . '.resource_builder'
 
const D_FLAVOUR_BUILDER = self::D_SERVICE . '.flavour_builder'
 
const D_REPOSITORY_PRELOADER = self::D_SERVICE . '.repository_preloader'
 
const D_SOURCE_BUILDER = self::D_SERVICE . '.source_builder'
 
const D_LOCK_HANDLER = self::D_SERVICE . '.lock_handler'
 
const D_FILENAME_POLICY = self::D_SERVICE . '.filename_policy'
 
const D_STREAM_ACCESS = self::D_SERVICE . '.stream_access'
 
const D_ARTIFACTS = self::D_SERVICE . '.artifacts'
 
const D_MACHINE_FACTORY = self::D_SERVICE . '.machine_factory'
 
const D_MIGRATOR = self::D_SERVICE . '.migrator'
 

Protected Member Functions

 buildBasePath ()
 

Private Attributes

bool $init = false
 

Detailed Description

Responsible for loading the Resource Storage into the dependency injection container of ILIAS.

Definition at line 50 of file InitResourceStorage.php.

Member Function Documentation

◆ buildBasePath()

InitResourceStorage::buildBasePath ( )
protected

Definition at line 225 of file InitResourceStorage.php.

225 : string
226 {
227 return (defined('ILIAS_DATA_DIR') && defined('CLIENT_ID'))
228 ? rtrim(ILIAS_DATA_DIR, "/") . "/" . CLIENT_ID
229 : '-';
230 }
const CLIENT_ID
Definition: constants.php:41
const ILIAS_DATA_DIR
Definition: constants.php:44

References CLIENT_ID, and ILIAS_DATA_DIR.

Referenced by init().

+ Here is the caller graph for this function:

◆ getFlavourBuilder()

InitResourceStorage::getFlavourBuilder ( \ILIAS\DI\Container  $c)

Definition at line 91 of file InitResourceStorage.php.

92 {
93 $this->init($c);
95 return new FlavourBuilder(
96 $c[self::D_REPOSITORIES]->getFlavourRepository(),
97 $c[self::D_MACHINE_FACTORY],
98 $c[self::D_RESOURCE_BUILDER],
99 $c[self::D_STORAGE_HANDLERS],
100 $c[self::D_STREAM_ACCESS],
101 new Subject(),
102 );
103 };
105 }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:36
init(\ILIAS\DI\Container $c)
$c
Definition: deliver.php:25

References $c, D_FLAVOUR_BUILDER, and init().

+ Here is the call graph for this function:

◆ getResourceBuilder()

InitResourceStorage::getResourceBuilder ( \ILIAS\DI\Container  $c)

Definition at line 72 of file InitResourceStorage.php.

73 {
74 $this->init($c);
76 return new ResourceBuilder(
77 $c[self::D_STORAGE_HANDLERS],
78 $c[self::D_REPOSITORIES],
79 $c[self::D_LOCK_HANDLER],
80 $c[self::D_STREAM_ACCESS],
81 $c[self::D_FILENAME_POLICY],
82 );
83 };
85 }

References $c, D_RESOURCE_BUILDER, and init().

Referenced by init().

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

◆ init()

InitResourceStorage::init ( \ILIAS\DI\Container  $c)

Definition at line 107 of file InitResourceStorage.php.

107 : void
108 {
109 if ($this->init) {
110 return;
111 }
112 $base_dir = $this->buildBasePath();
113
114 // DB Repositories
115 $c[self::D_REPOSITORIES] = static function (Container $c): Repositories {
116 return new Repositories(
117 new RevisionDBRepository($c->database()),
118 new ResourceDBRepository($c->database()),
119 new CollectionDBRepository($c->database()),
120 new InformationDBRepository($c->database()),
121 new StakeholderDBRepository($c->database()),
122 new FlavourDBRepository($c->database()),
123 );
124 };
125
126 // Repository Preloader
127 $c[self::D_REPOSITORY_PRELOADER] = static function (Container $c) {
128 return new DBRepositoryPreloader(
129 $c->database(),
130 $c[self::D_REPOSITORIES]
131 );
132 };
133
134 // Lock Handler
135 $c[self::D_LOCK_HANDLER] = static function (Container $c): LockHandler {
136 return new LockHandlerilDB($c->database());
137 };
138
139 // Storage Handlers
140 $c[self::D_STORAGE_HANDLERS] = static function (Container $c) use (
141 $base_dir
143 return new StorageHandlerFactory([
144 new MaxNestingFileSystemStorageHandler($c['filesystem.storage'], Location::STORAGE),
145 new FileSystemStorageHandler($c['filesystem.storage'], Location::STORAGE)
146 ], $base_dir);
147 };
148
149 // Source Builder for Consumers
150 $c[self::D_SOURCE_BUILDER] = static function (Container $c): ?SrcBuilder {
151 return new ilSecureTokenSrcBuilder(
152 $c->fileDelivery()
153 );
154 };
155
156 // Filename Policy for Consumers
158 if ($c->isDependencyAvailable('settings') && $c->isDependencyAvailable('clientIni')) {
159 return new ilFileServicesPolicy($c->fileServiceSettings());
160 }
161 return new NoneFileNamePolicy();
162 };
163
164 // Artifacts
165 $c[self::D_ARTIFACTS] = static function (Container $c): Artifacts {
166 $flavour_data = is_readable(ilResourceStorageFlavourArtifact::PATH()) ?
168 : [];
169 return new Artifacts(
170 $flavour_data['machines'] ?? [],
171 $flavour_data['definitions'] ?? []
172 );
173 };
174
175 // Stream Access for Consumers and internal Usage
176 $c[self::D_STREAM_ACCESS] = static function (Container $c) use ($base_dir): StreamAccess {
177 return new StreamAccess(
178 $base_dir,
179 $c[self::D_STORAGE_HANDLERS]
180 );
181 };
182
183 // Flavours
184 $c[self::D_MACHINE_FACTORY] = static function (Container $c): Factory {
185 return new Factory(
186 new \ILIAS\ResourceStorage\Flavour\Engine\Factory(),
187 $c[self::D_ARTIFACTS]->getFlavourMachines()
188 );
189 };
190
191 //
192 // IRSS
193 //
194 $c[self::D_SERVICE] = static function (Container $c): \ILIAS\ResourceStorage\Services {
195 $services = new \ILIAS\ResourceStorage\Services(
196 $c[self::D_STORAGE_HANDLERS],
197 $c[self::D_REPOSITORIES],
198 $c[self::D_ARTIFACTS],
199 $c[self::D_LOCK_HANDLER],
200 $c[self::D_FILENAME_POLICY],
201 $c[self::D_STREAM_ACCESS],
202 $c[self::D_MACHINE_FACTORY],
203 $c[self::D_SOURCE_BUILDER],
204 $c[self::D_REPOSITORY_PRELOADER],
205 );
206
207 // attach general observers
208 $services->events()->attach(new IRSSEventLogObserver($c->logger()->irss()), Event::ALL);
209
210 return $services;
211 };
212
213 $c[self::D_MIGRATOR] = function (Container $c) use ($base_dir): Migrator {
214 return new Migrator(
215 $c[self::D_STORAGE_HANDLERS],
216 $this->getResourceBuilder($c),
217 $c->database(),
218 $base_dir
219 );
220 };
221
222 $this->init = true;
223 }
getResourceBuilder(\ILIAS\DI\Container $c)
Class ilFileServicesPolicy.
@ ALL
event string being used if
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References $c, ALL, buildBasePath(), D_ARTIFACTS, D_FILENAME_POLICY, D_LOCK_HANDLER, D_MACHINE_FACTORY, D_MIGRATOR, D_REPOSITORIES, D_REPOSITORY_PRELOADER, D_SERVICE, D_SOURCE_BUILDER, D_STORAGE_HANDLERS, D_STREAM_ACCESS, getResourceBuilder(), init(), and ILIAS\Setup\Artifact\BuildArtifactObjective\PATH().

Referenced by getFlavourBuilder(), getResourceBuilder(), and init().

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

Field Documentation

◆ $init

bool InitResourceStorage::$init = false
private

Definition at line 66 of file InitResourceStorage.php.

◆ D_ARTIFACTS

const InitResourceStorage::D_ARTIFACTS = self::D_SERVICE . '.artifacts'

Definition at line 62 of file InitResourceStorage.php.

Referenced by init().

◆ D_FILENAME_POLICY

const InitResourceStorage::D_FILENAME_POLICY = self::D_SERVICE . '.filename_policy'

Definition at line 60 of file InitResourceStorage.php.

Referenced by init().

◆ D_FLAVOUR_BUILDER

const InitResourceStorage::D_FLAVOUR_BUILDER = self::D_SERVICE . '.flavour_builder'

Definition at line 56 of file InitResourceStorage.php.

Referenced by getFlavourBuilder().

◆ D_LOCK_HANDLER

const InitResourceStorage::D_LOCK_HANDLER = self::D_SERVICE . '.lock_handler'

Definition at line 59 of file InitResourceStorage.php.

Referenced by init().

◆ D_MACHINE_FACTORY

const InitResourceStorage::D_MACHINE_FACTORY = self::D_SERVICE . '.machine_factory'

Definition at line 63 of file InitResourceStorage.php.

Referenced by init().

◆ D_MIGRATOR

const InitResourceStorage::D_MIGRATOR = self::D_SERVICE . '.migrator'

Definition at line 64 of file InitResourceStorage.php.

Referenced by init().

◆ D_REPOSITORIES

const InitResourceStorage::D_REPOSITORIES = self::D_SERVICE . '.repositories'

Definition at line 53 of file InitResourceStorage.php.

Referenced by ilResourceStorageMigrationHelper\__construct(), and init().

◆ D_REPOSITORY_PRELOADER

const InitResourceStorage::D_REPOSITORY_PRELOADER = self::D_SERVICE . '.repository_preloader'

Definition at line 57 of file InitResourceStorage.php.

Referenced by ilResourceStorageMigrationHelper\__construct(), and init().

◆ D_RESOURCE_BUILDER

const InitResourceStorage::D_RESOURCE_BUILDER = self::D_SERVICE . '.resource_builder'

Definition at line 55 of file InitResourceStorage.php.

Referenced by getResourceBuilder().

◆ D_SERVICE

const InitResourceStorage::D_SERVICE = 'resource_storage'

Definition at line 52 of file InitResourceStorage.php.

Referenced by init().

◆ D_SOURCE_BUILDER

const InitResourceStorage::D_SOURCE_BUILDER = self::D_SERVICE . '.source_builder'

Definition at line 58 of file InitResourceStorage.php.

Referenced by init().

◆ D_STORAGE_HANDLERS

const InitResourceStorage::D_STORAGE_HANDLERS = self::D_SERVICE . '.storage_handlers'

Definition at line 54 of file InitResourceStorage.php.

Referenced by ilWACSignedResourceStorage\__construct(), and init().

◆ D_STREAM_ACCESS

const InitResourceStorage::D_STREAM_ACCESS = self::D_SERVICE . '.stream_access'

Definition at line 61 of file InitResourceStorage.php.

Referenced by ilWACSignedResourceStorage\__construct(), and init().


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