ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilObjCloudModuleMigration Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilObjCloudModuleMigration:
+ Collaboration diagram for ilObjCloudModuleMigration:

Public Member Functions

 getLabel ()
 
 getDefaultAmountOfStepsPerRun ()
 Tell the default amount of steps to be executed for one run of the migration. More...
 
 getRemainingAmountOfSteps ()
 Count up how many "things" need to be migrated. More...
 
 getPreconditions (Environment $environment)
 
 prepare (Environment $environment)
 Prepare the migration by means of some environment. More...
 
 step (Environment $environment)
 Run one step of the migration. More...
 

Protected Member Functions

 getCloudReferencesQuery ()
 

Protected Attributes

ilDBInterface $db
 

Additional Inherited Members

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

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Definition at line 24 of file ilObjCloudModuleMigration.php.

Member Function Documentation

◆ getCloudReferencesQuery()

ilObjCloudModuleMigration::getCloudReferencesQuery ( )
protected

Definition at line 74 of file ilObjCloudModuleMigration.php.

75  {
76  return $this->db->query("
77  SELECT ref_id
78  FROM object_data, object_reference
79  WHERE object_data.type = 'cld' AND object_data.obj_id = object_reference.obj_id");
80  }

◆ getDefaultAmountOfStepsPerRun()

ilObjCloudModuleMigration::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 33 of file ilObjCloudModuleMigration.php.

33  : int
34  {
35  return Migration::INFINITE;
36  }

◆ getLabel()

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

Implements ILIAS\Setup\Migration.

Definition at line 28 of file ilObjCloudModuleMigration.php.

28  : string
29  {
30  return 'ilObjCloudModule Data Removal. Attention, this deletes all Data of the Cloud Module from the Repository';
31  }

◆ getPreconditions()

ilObjCloudModuleMigration::getPreconditions ( Environment  $environment)
Returns
ilDatabaseUpdatedObjective[]|ilIniFilesLoadedObjective[]

Implements ILIAS\Setup\Migration.

Definition at line 50 of file ilObjCloudModuleMigration.php.

50  : array
51  {
52  return [
55  ];
56  }

◆ getRemainingAmountOfSteps()

ilObjCloudModuleMigration::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 38 of file ilObjCloudModuleMigration.php.

38  : int
39  {
40  if ($this->db->fetchObject($this->getCloudReferencesQuery())) {
41  return 1;
42  } else {
43  return 0;
44  }
45  }

◆ prepare()

ilObjCloudModuleMigration::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 58 of file ilObjCloudModuleMigration.php.

References ilContext\CONTEXT_CRON, ILIAS\Setup\Environment\getResource(), ilContext\init(), and ilInitialisation\initILIAS().

58  : void
59  {
60  //This is necessary for using ilObjects delete function to remove existing objects
63  $this->db = $environment->getResource(Environment::RESOURCE_DATABASE);
64  }
const CONTEXT_CRON
static initILIAS()
ilias initialisation
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
static init(string $a_type)
Init context by type.
+ Here is the call graph for this function:

◆ step()

ilObjCloudModuleMigration::step ( Environment  $environment)

Run one step of the migration.

Implements ILIAS\Setup\Migration.

Definition at line 66 of file ilObjCloudModuleMigration.php.

66  : void
67  {
68  while ($result = $this->db->fetchObject($this->getCloudReferencesQuery())) {
69  $cloud_object = new ilObjCloud((int) $result->ref_id);
70  $cloud_object->delete();
71  }
72  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

Field Documentation

◆ $db

ilDBInterface ilObjCloudModuleMigration::$db
protected

Definition at line 26 of file ilObjCloudModuleMigration.php.


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