ILIAS  release_8 Revision v8.23
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)
 
 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_BUILDER = self::D_SERVICE . '.resource_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'
 

Protected Member Functions

 buildBasePath ()
 

Detailed Description

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

Definition at line 42 of file InitResourceStorage.php.

Member Function Documentation

◆ buildBasePath()

InitResourceStorage::buildBasePath ( )
protected

Definition at line 146 of file InitResourceStorage.php.

References CLIENT_ID, and ILIAS_DATA_DIR.

Referenced by init().

146  : string
147  {
148  return (defined('ILIAS_DATA_DIR') && defined('CLIENT_ID'))
149  ? rtrim(ILIAS_DATA_DIR, "/") . "/" . CLIENT_ID
150  : '-';
151  }
const CLIENT_ID
Definition: constants.php:41
const ILIAS_DATA_DIR
Definition: constants.php:44
+ Here is the caller graph for this function:

◆ getResourceBuilder()

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

Definition at line 58 of file InitResourceStorage.php.

References $c.

59  {
60  self::init($c);
61  $c[self::D_BUILDER] = function (Container $c): ResourceBuilder {
62  return new ResourceBuilder(
63  $c[self::D_STORAGE_HANDLERS],
64  $c[self::D_REPOSITORIES],
65  $c[self::D_LOCK_HANDLER],
66  $c[self::D_STREAM_ACCESS],
67  $c[self::D_FILENAME_POLICY],
68  );
69  };
70  return $c[self::D_BUILDER];
71  }
$c
Definition: cli.php:38
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31

◆ init()

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

Definition at line 73 of file InitResourceStorage.php.

References $c, and buildBasePath().

73  : void
74  {
75  $base_dir = $this->buildBasePath();
76 
77  // DB Repositories
78  $c[self::D_REPOSITORIES] = static function (Container $c): Repositories {
79  return new Repositories(
80  new RevisionDBRepository($c->database()),
81  new ResourceDBRepository($c->database()),
82  new CollectionDBRepository($c->database()),
83  new InformationDBRepository($c->database()),
84  new StakeholderDBRepository($c->database())
85  );
86  };
87 
88  // Repository Preloader
89  $c[self::D_REPOSITORY_PRELOADER] = static function (Container $c) {
90  return new DBRepositoryPreloader(
91  $c->database(),
92  $c[self::D_REPOSITORIES]
93  );
94  };
95 
96  // Lock Handler
97  $c[self::D_LOCK_HANDLER] = static function (Container $c): LockHandler {
98  return new LockHandlerilDB($c->database());
99  };
100 
101  // Storage Handlers
102  $c[self::D_STORAGE_HANDLERS] = static function (Container $c) use ($base_dir): StorageHandlerFactory {
103  return new StorageHandlerFactory([
104  new MaxNestingFileSystemStorageHandler($c['filesystem.storage'], Location::STORAGE),
105  new FileSystemStorageHandler($c['filesystem.storage'], Location::STORAGE)
106  ], $base_dir);
107  };
108 
109  // Source Builder for Consumers
110  $c[self::D_SOURCE_BUILDER] = static function (Container $c): ?SrcBuilder {
111  return null;
112  };
113 
114  // Filename Policy for Consumers
115  $c[self::D_FILENAME_POLICY] = static function (Container $c): FileNamePolicy {
116  if ($c->isDependencyAvailable('settings') && $c->isDependencyAvailable('clientIni')) {
117  return new ilFileServicesPolicy($c->fileServiceSettings());
118  }
119  return new NoneFileNamePolicy();
120  };
121 
122  // Stream Access for Consumers and internal Usage
123  $c[self::D_STREAM_ACCESS] = static function (Container $c) use ($base_dir): StreamAccess {
124  return new StreamAccess(
125  $base_dir,
126  $c[self::D_STORAGE_HANDLERS]
127  );
128  };
129 
130  //
131  // IRSS
132  //
133  $c[self::D_SERVICE] = static function (Container $c): \ILIAS\ResourceStorage\Services {
134  return new \ILIAS\ResourceStorage\Services(
135  $c[self::D_STORAGE_HANDLERS],
136  $c[self::D_REPOSITORIES],
137  $c[self::D_LOCK_HANDLER],
138  $c[self::D_FILENAME_POLICY],
139  $c[self::D_STREAM_ACCESS],
140  $c[self::D_SOURCE_BUILDER],
141  $c[self::D_REPOSITORY_PRELOADER],
142  );
143  };
144  }
$c
Definition: cli.php:38
Class ilFileServicesPolicy.
Class ChatMainBarProvider .
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

Field Documentation

◆ D_BUILDER

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

Definition at line 47 of file InitResourceStorage.php.

◆ D_FILENAME_POLICY

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

Definition at line 51 of file InitResourceStorage.php.

◆ D_LOCK_HANDLER

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

Definition at line 50 of file InitResourceStorage.php.

◆ D_REPOSITORIES

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

Definition at line 45 of file InitResourceStorage.php.

◆ D_REPOSITORY_PRELOADER

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

◆ D_SERVICE

const InitResourceStorage::D_SERVICE = 'resource_storage'

Definition at line 44 of file InitResourceStorage.php.

◆ D_SOURCE_BUILDER

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

Definition at line 49 of file InitResourceStorage.php.

◆ D_STORAGE_HANDLERS

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

Definition at line 46 of file InitResourceStorage.php.

Referenced by ilStorageHandlerV1Migration\prepare().

◆ D_STREAM_ACCESS

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

Definition at line 52 of file InitResourceStorage.php.


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