ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
ilStorageHandlerV1Migration Class Reference

Class ilStorageHandlerV1Migration. More...

+ Inheritance diagram for ilStorageHandlerV1Migration:
+ Collaboration diagram for ilStorageHandlerV1Migration:

Public Member Functions

 getLabel ()
 
 getDefaultAmountOfStepsPerRun ()
 Tell the default amount of steps to be executed for one run of the migration. More...
 
 getPreconditions (Environment $environment)
 
 prepare (Environment $environment)
 Prepare the migration by means of some environment. More...
 
 getRemainingAmountOfSteps ()
 Count up how many "things" need to be migrated. More...
 
- Public Member Functions inherited from ILIAS\Setup\Migration
 step (Environment $environment)
 Run one step of the migration. More...
 

Protected Attributes

DirectoryIterator $iterator
 
 $database
 
ILIAS ResourceStorage StorageHandler Migrator $migrator = null
 
ILIAS ResourceStorage Resource ResourceBuilder $resource_builder = null
 
string $data_dir = null
 
string $from = 'fsv1'
 
string $to = 'fsv2'
 

Additional Inherited Members

- Data Fields inherited from ILIAS\Setup\Migration
const INFINITE = -1
 

Detailed Description

Member Function Documentation

◆ getDefaultAmountOfStepsPerRun()

ilStorageHandlerV1Migration::getDefaultAmountOfStepsPerRun ( )

Tell the default amount of steps to be executed for one run of the migration.

Return Migration::INFINITE if all units should be migrated at once.

Implements ILIAS\Setup\Migration.

Definition at line 51 of file class.ilStorageHandlerV1Migration.php.

51  : int
52  {
53  return 10000;
54  }

◆ getLabel()

ilStorageHandlerV1Migration::getLabel ( )
Returns
string - a meaningful and concise description for your migration.

Implements ILIAS\Setup\Migration.

Definition at line 46 of file class.ilStorageHandlerV1Migration.php.

46  : string
47  {
48  return \ilStorageHandlerV1Migration::class;
49  }

◆ getPreconditions()

ilStorageHandlerV1Migration::getPreconditions ( Environment  $environment)
Returns
[]|[]|[]

Implements ILIAS\Setup\Migration.

Definition at line 59 of file class.ilStorageHandlerV1Migration.php.

59  : array
60  {
61  return [
62  new \ilIniFilesLoadedObjective(),
63  new \ilDatabaseUpdatedObjective(),
65  ];
66  }

◆ getRemainingAmountOfSteps()

ilStorageHandlerV1Migration::getRemainingAmountOfSteps ( )

Count up how many "things" need to be migrated.

This helps the admin to decide how big he can create the steps and also how long a migration takes

Implements ILIAS\Setup\Migration.

Definition at line 130 of file class.ilStorageHandlerV1Migration.php.

References $d.

130  : int
131  {
132  $r = $this->database->queryF(
133  "SELECT COUNT(rid) as old_storage FROM il_resource WHERE storage_id != %s",
134  ['text'],
135  [$this->to]
136  );
137  $d = $this->database->fetchObject($r);
138 
139  return (int)($d->old_storage ?? 0);
140  }
for($i=6; $i< 13; $i++) for($i=1; $i< 13; $i++) $d
Definition: date.php:296

◆ prepare()

ilStorageHandlerV1Migration::prepare ( Environment  $environment)

Prepare the migration by means of some environment.

This is not supposed to modify the environment, but will be run to prime the migration object to run step and getRemainingAmountOfSteps afterwards.

$DIC

$DIC

Implements ILIAS\Setup\Migration.

Definition at line 68 of file class.ilStorageHandlerV1Migration.php.

References $client_id, $container, $d, $database, $DIC, Vendor\Package\$f, $GLOBALS, $i, InitResourceStorage\D_STORAGE_HANDLERS, ILIAS\Setup\Environment\getResource(), and ILIAS\Setup\Migration\step().

68  : void
69  {
70  $ilias_ini = $environment->getResource(Environment::RESOURCE_ILIAS_INI);
71  $client_id = $environment->getResource(Environment::RESOURCE_CLIENT_ID);
72 
73  $data_dir = $ilias_ini->readVariable('clients', 'datadir');
74  $this->data_dir = $data_dir . "/" . $client_id;
75 
76  $configuration = new LocalConfig("{$data_dir}/{$client_id}");
78  $filesystem = $f->getLocal($configuration);
79 
80  $this->database = $environment->getResource(Environment::RESOURCE_DATABASE);
82  // ATTENTION: This is a total abomination. It only exists to allow the db-
83  // update to run. This is a memento to the fact, that dependency injection
84  // is something we want. Currently, every component could just service
85  // locate the whole world via the global $DIC.
87  $DIC = $GLOBALS["DIC"] ?? [];
88  $GLOBALS["DIC"] = new Container();
89  $GLOBALS["DIC"]["ilDB"] = $this->database;
90  $GLOBALS["ilDB"] = $this->database;
91 
92  // Build Container
93  $init = new InitResourceStorage();
94  $container = new Container();
95  $container['ilDB'] = $this->database;
96  $container['filesystem.storage'] = $filesystem;
97 
98  $this->resource_builder = $init->getResourceBuilder($container);
99 
100  $this->migrator = new Migrator(
102  $this->resource_builder,
103  $this->database,
104  $this->data_dir
105  );
106  }
Responsible for loading the Resource Storage into the dependency injection container of ILIAS...
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:31
$container
Definition: wac.php:14
global $DIC
Definition: feed.php:28
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
$client_id
Definition: ltiauth.php:68
+ Here is the call graph for this function:

Field Documentation

◆ $data_dir

string ilStorageHandlerV1Migration::$data_dir = null
protected

Definition at line 41 of file class.ilStorageHandlerV1Migration.php.

◆ $database

ilStorageHandlerV1Migration::$database
protected

Definition at line 38 of file class.ilStorageHandlerV1Migration.php.

Referenced by prepare().

◆ $from

string ilStorageHandlerV1Migration::$from = 'fsv1'
protected

Definition at line 43 of file class.ilStorageHandlerV1Migration.php.

◆ $iterator

DirectoryIterator ilStorageHandlerV1Migration::$iterator
protected

Definition at line 34 of file class.ilStorageHandlerV1Migration.php.

◆ $migrator

ILIAS ResourceStorage StorageHandler Migrator ilStorageHandlerV1Migration::$migrator = null
protected

Definition at line 39 of file class.ilStorageHandlerV1Migration.php.

◆ $resource_builder

ILIAS ResourceStorage Resource ResourceBuilder ilStorageHandlerV1Migration::$resource_builder = null
protected

Definition at line 40 of file class.ilStorageHandlerV1Migration.php.

◆ $to

string ilStorageHandlerV1Migration::$to = 'fsv2'
protected

Definition at line 44 of file class.ilStorageHandlerV1Migration.php.


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