ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
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 (Container $c)
 
 getFlavourBuilder (Container $c)
 
 init (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.

Deprecated:
Use from bootstrapping

Definition at line 51 of file InitResourceStorage.php.

Member Function Documentation

◆ buildBasePath()

InitResourceStorage::buildBasePath ( )
protected

Definition at line 201 of file InitResourceStorage.php.

201 : string
202 {
203 return (defined('ILIAS_DATA_DIR') && defined('CLIENT_ID'))
204 ? rtrim((string) ILIAS_DATA_DIR, "/") . "/" . CLIENT_ID
205 : '-';
206 }
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 ( Container  $c)

Definition at line 90 of file InitResourceStorage.php.

References Vendor\Package\$c, D_FLAVOUR_BUILDER, and init().

+ Here is the call graph for this function:

◆ getResourceBuilder()

InitResourceStorage::getResourceBuilder ( Container  $c)

Definition at line 73 of file InitResourceStorage.php.

References Vendor\Package\$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 ( Container  $c)

Definition at line 104 of file InitResourceStorage.php.

104 : void
105 {
106 if ($this->init) {
107 return;
108 }
109 $base_dir = $this->buildBasePath();
110
111 // DB Repositories
119 ));
120
121 // Repository Preloader
123 $c->database(),
124 $c[self::D_REPOSITORIES]
125 ));
126
127 // Lock Handler
129
130 // Storage Handlers
132 new MaxNestingFileSystemStorageHandler($c['filesystem.storage'], Location::STORAGE),
133 new FileSystemStorageHandler($c['filesystem.storage'], Location::STORAGE)
134 ], $base_dir));
135
136 // Source Builder for Consumers
138 $c->fileDelivery()
139 ));
140
141 // Filename Policy for Consumers
143 if ($c->isDependencyAvailable('settings') && $c->isDependencyAvailable('clientIni')) {
144 return new ilFileServicesPolicy($c->fileServiceSettings());
145 }
146 return new NoneFileNamePolicy();
147 };
148
149 // Artifacts
150 $c[self::D_ARTIFACTS] = static function (Container $c): Artifacts {
151 $flavour_data = is_readable(ilResourceStorageFlavourArtifact::PATH()) ?
153 : [];
154 return new Artifacts(
155 $flavour_data['machines'] ?? [],
156 $flavour_data['definitions'] ?? []
157 );
158 };
159
160 // Stream Access for Consumers and internal Usage
162 $base_dir,
164 ));
165
166 // Flavours
167 $c[self::D_MACHINE_FACTORY] = (static fn(Container $c): Factory => new Factory(
168 new \ILIAS\ResourceStorage\Flavour\Engine\Factory(),
169 $c[self::D_ARTIFACTS]->getFlavourMachines()
170 ));
171
172 //
173 // IRSS
174 //
175 $c[self::D_SERVICE] = (static fn(Container $c): Services => new Services(
176 $c[self::D_STORAGE_HANDLERS],
177 $c[self::D_REPOSITORIES],
178 $c[self::D_ARTIFACTS],
179 $c[self::D_LOCK_HANDLER],
180 $c[self::D_FILENAME_POLICY],
181 $c[self::D_STREAM_ACCESS],
182 $c[self::D_MACHINE_FACTORY],
183 $c[self::D_SOURCE_BUILDER],
185 static fn(): \ilLogger => $c->logger()->irss(),
186 ));
187
188 $c[self::D_MIGRATOR] = function (Container $c) use ($base_dir): Migrator {
189 $rb = $this->getResourceBuilder($c);
190 return new Migrator(
191 $c[self::D_STORAGE_HANDLERS],
192 static fn(StorableResource $r): bool => $rb->remove($r),
193 $c->database(),
194 $base_dir
195 );
196 };
197
198 $this->init = true;
199 }
getResourceBuilder(Container $c)
Component logger with individual log levels by component id.
Interface Location.
Definition: Location.php:33
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.

References Vendor\Package\$c, 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 67 of file InitResourceStorage.php.

◆ D_ARTIFACTS

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

Definition at line 63 of file InitResourceStorage.php.

Referenced by init().

◆ D_FILENAME_POLICY

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

Definition at line 61 of file InitResourceStorage.php.

Referenced by init().

◆ D_FLAVOUR_BUILDER

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

Definition at line 57 of file InitResourceStorage.php.

Referenced by getFlavourBuilder().

◆ D_LOCK_HANDLER

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

Definition at line 60 of file InitResourceStorage.php.

Referenced by init().

◆ D_MACHINE_FACTORY

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

Definition at line 64 of file InitResourceStorage.php.

Referenced by init().

◆ D_MIGRATOR

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

Definition at line 65 of file InitResourceStorage.php.

Referenced by init().

◆ D_REPOSITORIES

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

◆ D_REPOSITORY_PRELOADER

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

Definition at line 58 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 56 of file InitResourceStorage.php.

Referenced by getResourceBuilder().

◆ D_SERVICE

const InitResourceStorage::D_SERVICE = 'resource_storage'

Definition at line 53 of file InitResourceStorage.php.

Referenced by init().

◆ D_SOURCE_BUILDER

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

Definition at line 59 of file InitResourceStorage.php.

Referenced by init().

◆ D_STORAGE_HANDLERS

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

Definition at line 55 of file InitResourceStorage.php.

Referenced by init().

◆ D_STREAM_ACCESS

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

Definition at line 62 of file InitResourceStorage.php.

Referenced by init().


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