Ikona Wiki

Feature Wiki

Information about planned and released features

Zakładka

Project: ILIAS Resource Storage Service (IRSS)

This is a project page that bundles several feature wiki pages which belong to a larger development activity for the File component in ILIAS.

1 Aim of Project

«All user-uploaded files shall be stored centralized in one Service»
ILIAS uses in many components the possibility for users to upload their own files and to download or display them again at a later time. Some parts of this process are already centralized (FileUpload-Service, FileDelivery-Service). But not the central storage of files in the file system. Many components have implemented this part independently. Due to the different implementations, problems related to files occur again and again (see detailed description).

The "Resource Storage Service" project aims to have all files stored and managed centrally by a service. The components that use files from users in ILIAS should be able to use the service in a simple way.
The project includes various developments and changes in ILIAS. On the one hand the service is introduced as a central storage management in ILIAS. On the other hand, individual components that use files will have to be modified bit by bit.During these modifications files that have been stored for years have to be migrated to the Resource Storage Service.

Parallel to the migration of existing components, new features can be planned and implemented through centralisation.

The concrete objectives:
  • In ILIAS there is only one central place where uploaded files are stored
  • Existing components are converted so that they no longer have any dependencies on other objects (e.g. FileObject).
  • The implementation of features that include user uploads should become easier and cheaper.
 
 
 
Centralization and the Migration of Components to the Resource Storage Service is important because
  • Problems related to the storage of files can be solved centrally
  • Problems that occurred in the past, e.g. in connection with special characters in file names, are now a thing of the past
  • Features related to files will be easier to implement
  • Security is increased, security problems with files can be solved centrally
  • Whitelisting no longer needs to be done in the FileSystem but can be done when files are delivered
  • Storage options other than the web server hard disk will be possible in the future

1.1 Conceptual Summary

1.2 The ILIAS Resource Storage Service (IRSS)

The Resource Storage Service was introduced in a first version in ILIAS 6 where it was used to store icons for MainMenu entries. This allowed first experiences to be gathered and the service to be further expanded.
The principle of the service is simple. A file uploaded by a user is forwarded by a component (e.g. forum) to the storage service. In return, the components receive an identification (unique ID of the resource as a string). This ID is stored by the component. If the file is then needed again, the component with the ID can ask the Storage Service for a consumer (e.g. DownloadConsumer, InlineConsumer, ...) and execute it. In this way, the uploaded image is displayed, for example.

Resource Storage Service

Overview

The Resource Storage Service should be the central place where components and plugins should manage their user uploaded files and resources.

Historically ILIAS uses the file system directly in its components to manage files. There are some conventions but within the structure of a component files can be stored freely. Additional features such as versioning of files is always the responsibility of the component or the plugin.

ILIAS 7 offers the Resource Storage Service for all components and plug-ins.

In summary, the service allows to exchange a user upload (UploadResult from the Upload-Service) for a unique resource ID. During this exchange, the service takes care of the correct storage of the data (file as well as metadatan to the file). There is no direct access of the component to the FileSystem, neither by native PHP functions nor by the FileSystem service. As soon as the UserUpload is needed again, e.g. to display or download it, the Resource-ID can be exchanged for a corresponding delivery method. This process also does not directly access the file system by the component.

  Component                 +-+ Resource
                            | | Storage
  +----------+              | | Service
  | UPLOAD   +--------------> |
  +----------+              | |
                            | |
                            | |
  +----------+              | |
  | ID       <--------------+ |
  +----------+              | |
                            | |
                            | |
+---------------------------------+
                            | |
                            | |
  +----------+              | |
  | ID       +--------------> |
  +----------+              | |
                            | |
                            | |
  +----------+              | |
  | CONSUMER <--------------+ |
  +----------+              | |
                            | |
                            | |
                            +-+

Terms

+---------------------------------------------------------------------+
| RESOURCE                                                            |
+---------------------------------------------------------------------+
|                                                                     |
| +--------------------+                                              |
| | IDENTIFICATION     |                                              |
| +--------------------+                                              |
|                                                                     |
| +-------------------+  +-------------------+  +-------------------+ |
| | REVISION          |  | REVISION          |  | REVISION          | |
| +-------------------+  +-------------------+  +-------------------+ |
| |                   |  |                   |  |                   | |
| | +---------------+ |  | +---------------+ |  | +---------------+ | |
| | | INFORMATION   | |  | | INFORMATION   | |  | | INFORMATION   | | |
| | +---------------+ |  | +---------------+ |  | +---------------+ | |
| | | "FILE"        | |  | | "FILE"        | |  | | "FILE"        | | |
| | +---------------+ |  | +---------------+ |  | +---------------+ | |
| |                   |  |                   |  |                   | |
| +-------------------+  +-------------------+  +-------------------+ |
|                                                                     |
+---------------------------------------------------------------------+

Resource

A Resource is the abstract term for a "thing" uploaded by a user and passed to the Resource Storage Service for management. The Resource is the combination of - Identification - Revisions - Information about the revisions - File or its contents (of the respective revisions) - Stakeholders

Identification

The identification represents the unique information about which resource is involved. This information is stored by the component itself to be able to retrieve a resource later.

Revision

Revisions contain the file together with metadata (information) and a version number. This means that a resource can have multiple revisions. The management of these revisions is the responsibility of the Service. Revisions can be added, changed or deleted from outside by the components.

Information

Information holds general metadata about a revision, such as MimeType, size, title, ... . This information is stored by the service.

Consumer

Consumers allow to "consume" a resource. This is the interface closest to the FileSystem that is allowed to start an action with the file of a revision, such as - Download - Get Stream - Retrieve content - Get the absolute Path of the file (only for legagy purposes) - ...

A set of Comsumers is already part of the service.

Stakeholder

Although resources are uploaded to ILIAS by users, these users are not only responsible for a resource but also for the component in which the file has been uploaded. The service must be able to retrieve information from the component in order to decide whether a resource is needed at all or not, e.g. during cleanup processes. Or, if a resource is removed by the service for security reasons, the component must be informed about it, in order to carry out further cleanup steps.

StorageHandler (internal)

In order to be equipped for the future, the Storage Service internally uses so-called StorageHandlers to store files. In the first step this is of course a FileSystem-based storage handler. However, the way is open here to expand this at a later point in time.

Usage

The use of the service should be as easy as possible from the point of view of the components and Plugins. The components should only communicate with the service according to the principle shown above, i.e. exchange uploads for identifications or exchange an identification for a consumer.

Examples

In most cases most of the work is already done by the UI inputs and as a form developer you get the identification directly from the service which can then be stored in your component.

In case you want to exchange an upload for an identification yourself, proceed as follows in your component:

<?php
// ...
global $DIC;
$upload_result = $DIC['upload']->getResults()['my_uploaded_file'];
$stakeholder = new ilMyComponentResourceStakeholder();

$identification = $DIC['resource_storage']->manage()->upload($upload_result, $stakeholder);

// then store the $identification whereever I need it in my component


Suppose we already have a file stored in the Storage Service and would download it in our component. We had stored the identification, with which a corresponding consumer can now be obtained to download the file.

<?php
// ...
global $DIC;
$rid_string = $this->getMyResourceIDasString(); // we get the stored ID of the resource

$identification  = $DIC['resource_storage']->manage()->find($rid_string);
if (null !== $identification) {
    $DIC['resource_storage']->consume()->download($identification)->run();
} else {
    // there is no such resource in the storage service
}

Adding a new revision is as simple as that:

<?php
// ...
global $DIC;
$rid_string = $this->getMyResourceIDasString(); // we get the stored ID of the resource

$identification  = $DIC['resource_storage']->manage()->find($rid_string);
$upload_result = $DIC['upload']->getResults()['my_uploaded_file'];
$stakeholder = new ilMyComponentResourceStakeholder();

if (null !== $identification) {
    $DIC['resource_storage']->manage()->appendNewRevision($identification, $upload_result, $stakeholder);
} else {
    // there is no such resource in the storage service
}

Other (involved) Services

  • UploadService, see here
  • FileSystem-Service, see here

Migration

  • Migration will need at least the feature "Migrate Command"
  • A documentation how you can migrate your component will follow ASAP

Roadmap

Please see the roapmap of the service in README.md

 

1.3 Migrations

Files were historically stored by the components in a directory in the iliasdata or data directory. If a component wants to use the Storage Service to manage files, all existing files of this component have to be moved to the Storage Service once.
This task can take a long time depending on the components and the size of the installation. To make this easy ILIAS 7 offers the possibility to perform migrations in the setup. A migration can be executed in many small parts, for example file by file. Such an implementation has already been done for ILIAS 7 for the file object. But since many other components use the FileObject internally as well this has been rewritten so that the old methods still work. In a further step all these components have to be rewritten so that they directly use the storage service and no longer the file object. In a further step, all other places that work with uploaded files should also be reprogrammed.

1.4 Features in Future

The central administration of all files will enable new features in the future.
For example, it will be possible to reintroduce a quota per user, which will then work globally for all uploaded files.
ILIAS will be able to perform regular actions on all files, e.g. checking for viruses or checking if files are orphaned and delete them automatically.

2 Involved Maintainers and Stakeholders

3 Timeline

Release
Objectives and developments
With ILIAS 7 the following topics were tackled and implemented:
  • The Resource Stoage Service has been implemented and is available via DIC The service is therefore usable for all components and offers all necessary functions to store and manage files. See Introduction of Resource Storage Service
  • Migrations are possible: The CLI setup of ILIAS 7 has been extended so that large migrations can be initiated and tracked after an update. See Setup - Add migrate Command
  • The first migration was the migration of the file object. Due to the large number of file objects in ILIAS the file object was converted to work with already migrated as well as with not yet migrated files. Thus an installation can be put back into operation immediately after the update. The migration of the file objects can then be done during operation. See IRSS: Migrate File-Object-Files to IRSS
Status
With ILIAS 8 we aim to address the following points:
  • As many components as possible should be converted to the Resource Storage Service. The main focus is on all those components that have been using the file object internally so far. We will gradually ask the respective maintainers whether we or they would like to carry out the conversion themselves. See the List in IRSS: General Overview of Components to Migrate (ongoing)
  • Not directly related, but to facilitate the use of the service, additional UI file upload inputs will be written. For example a photo upload with preview function, a multi-file upload and a selection field of already uploaded resources
Some components use uploaded content that is not a single file but a collection of files, such as HTML or SCORM learning modules. For this purpose, the storage service is extended by containers that can manage such related files.

4 Related Feature Requests and Status

5 Further Results

6 Additional Information

7 General Discussion

Please discuss specific questions of feature requests on the related feature wiki pages. This discussion section is only for a general discussion of the project and its realisation.
Schmid, Fabian [fschmid] 2019-03-01: A basic version of a File-Storage-Service should be implemented for the feature Customisable Main Bar - Icon Upload. The service won't be rolled out to the whole ILIAS base with 6.0. 
JourFixe, ILIAS [jourfixe], 11 MAY 2020 : We highly appreciate the suggested project. The project manager will provide a template for such project pages, soon. And he will help to adapt the content to this structure. All related feature requests and pull requests should be listed here but discussed separately. (Done in the meantime.)

Ostatnio zmieniono:: 19. Sie 2021, 13:59, Kunkel, Matthias [mkunkel]