ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 Objectives the migration depend on. More...
 
 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

 $iterator
 
 $database
 
 $migrator
 
 $resource_builder
 
 $data_dir
 
 $from = 'fsv1'
 
 $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.

Returns
int

Implements ILIAS\Setup\Migration.

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

58  : int
59  {
60  return 10000;
61  }

◆ getLabel()

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

Implements ILIAS\Setup\Migration.

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

53  : string
54  {
55  return 'ilStorageHandlerV1Migration';
56  }

◆ getPreconditions()

ilStorageHandlerV1Migration::getPreconditions ( Environment  $environment)

Objectives the migration depend on.

Exceptions
UnachievableExceptionif the objective is not achievable
Returns
Objective[]

Implements ILIAS\Setup\Migration.

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

63  : array
64  {
65  return [
66  new \ilIniFilesLoadedObjective(),
67  new \ilDatabaseUpdatedObjective(),
69  ];
70  }

◆ 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

Returns
int

Implements ILIAS\Setup\Migration.

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

References $d.

139  : int
140  {
141  $r = $this->database->queryF(
142  "SELECT COUNT(rid) as old_storage FROM il_resource WHERE storage_id != %s",
143  ['text'],
144  [$this->to]
145  );
146  $d = $this->database->fetchObject($r);
147 
148  return (int) ($d->old_storage ?? 0);
149  }
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.

Implements ILIAS\Setup\Migration.

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

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

72  : void
73  {
74  $ilias_ini = $environment->getResource(Environment::RESOURCE_ILIAS_INI);
75  $client_id = $environment->getResource(Environment::RESOURCE_CLIENT_ID);
76 
77  $data_dir = $ilias_ini->readVariable('clients', 'datadir');
78  $this->data_dir = $data_dir . "/" . $client_id;
79 
80  $configuration = new LocalConfig("{$data_dir}/{$client_id}");
82  $filesystem = $f->getLocal($configuration);
83 
84  $this->database = $environment->getResource(Environment::RESOURCE_DATABASE);
85 
86  // ATTENTION: This is a total abomination. It only exists to allow the db-
87  // update to run. This is a memento to the fact, that dependency injection
88  // is something we want. Currently, every component could just service
89  // locate the whole world via the global $DIC.
90  $DIC = $GLOBALS["DIC"] ?? [];
91  $GLOBALS["DIC"] = new Container();
92  $GLOBALS["DIC"]["ilDB"] = $this->database;
93  $GLOBALS["ilDB"] = $this->database;
94 
95  $storage_handler_factory = new StorageHandlerFactory([
96  new MaxNestingFileSystemStorageHandler($filesystem, Location::STORAGE),
97  new FileSystemStorageHandler($filesystem, Location::STORAGE)
98  ]);
99 
100  $this->resource_builder = new ResourceBuilder(
101  $storage_handler_factory,
102  new RevisionDBRepository($this->database),
103  new ResourceDBRepository($this->database),
104  new InformationDBRepository($this->database),
105  new StakeholderDBRepository($this->database),
106  new LockHandlerilDB($this->database),
107  new FileNamePolicyStack()
108  );
109 
110  $this->migrator = new Migrator(
111  $storage_handler_factory,
112  $this->resource_builder,
113  $this->database,
114  $this->data_dir
115  );
116 
117  }
Customizing of pimple-DIC for ILIAS.
Definition: Container.php:18
$client_id
Definition: webdav.php:17
global $DIC
Definition: goto.php:24
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.
Class LocalConfig This class is used to configure the local filesystem adapter.
Definition: LocalConfig.php:13
+ Here is the call graph for this function:

Field Documentation

◆ $data_dir

ilStorageHandlerV1Migration::$data_dir
protected

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

Referenced by prepare().

◆ $database

ilStorageHandlerV1Migration::$database
protected

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

Referenced by prepare().

◆ $from

ilStorageHandlerV1Migration::$from = 'fsv1'
protected

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

◆ $iterator

ilStorageHandlerV1Migration::$iterator
protected

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

◆ $migrator

ilStorageHandlerV1Migration::$migrator
protected

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

◆ $resource_builder

ilStorageHandlerV1Migration::$resource_builder
protected

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

◆ $to

ilStorageHandlerV1Migration::$to = 'fsv2'
protected

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


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