ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilGlossaryCollectionMigration Class Reference
+ Inheritance diagram for ilGlossaryCollectionMigration:
+ Collaboration diagram for ilGlossaryCollectionMigration:

Public Member Functions

 getLabel ()
 
 getDefaultAmountOfStepsPerRun ()
 
 getPreconditions (Environment $environment)
 
 prepare (Environment $environment)
 
 step (Environment $environment)
 
 getRemainingAmountOfSteps ()
 

Protected Member Functions

 log (string $str)
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Member Function Documentation

◆ getDefaultAmountOfStepsPerRun()

ilGlossaryCollectionMigration::getDefaultAmountOfStepsPerRun ( )

Definition at line 37 of file class.ilGlossaryCollectionMigration.php.

37  : int
38  {
39  return Migration::INFINITE;
40  }

◆ getLabel()

ilGlossaryCollectionMigration::getLabel ( )

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

32  : string
33  {
34  return "Migration of collection glossaries due to revision";
35  }

◆ getPreconditions()

ilGlossaryCollectionMigration::getPreconditions ( Environment  $environment)

◆ getRemainingAmountOfSteps()

ilGlossaryCollectionMigration::getRemainingAmountOfSteps ( )

Definition at line 96 of file class.ilGlossaryCollectionMigration.php.

96  : int
97  {
98  $set = $this->db->query(
99  "SELECT glossary.virtual FROM glossary " .
100  " WHERE glossary.virtual = 'level' OR glossary.virtual = 'subtree'"
101  );
102  if ($rec = $this->db->fetchAssoc($set)) {
103  return 1;
104  }
105 
106  return 0;
107  }

◆ log()

ilGlossaryCollectionMigration::log ( string  $str)
protected

Definition at line 91 of file class.ilGlossaryCollectionMigration.php.

Referenced by step().

91  : void
92  {
93  echo "\n" . $str;
94  }
+ Here is the caller graph for this function:

◆ prepare()

ilGlossaryCollectionMigration::prepare ( Environment  $environment)

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

References ILIAS\Setup\Environment\getResource().

51  : void
52  {
53  $this->db = $environment->getResource(Environment::RESOURCE_DATABASE);
54  }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
+ Here is the call graph for this function:

◆ step()

ilGlossaryCollectionMigration::step ( Environment  $environment)

Definition at line 56 of file class.ilGlossaryCollectionMigration.php.

References ILIAS\Repository\int(), and log().

56  : void
57  {
58  $set = $this->db->query(
59  "SELECT glossary.id AS glossary_id, glossary.virtual, glossary_term.id AS term_id, glossary_term.glo_id " .
60  " FROM glossary LEFT JOIN glossary_term ON glossary.id = glossary_term.glo_id " .
61  " WHERE glossary.virtual = 'level' OR glossary.virtual = 'subtree' " .
62  " ORDER BY glossary.id"
63  );
64  $tmp_id = 0;
65  while ($rec = $this->db->fetchAssoc($set)) {
66  $glo_id = (int) $rec["glossary_id"];
67  $term_id = (int) $rec["term_id"];
68  if ($glo_id === $tmp_id) {
69  continue;
70  }
71  if ($term_id > 0) {
72  $this->db->manipulate(
73  "UPDATE glossary SET " .
74  " glossary.virtual = " . $this->db->quote("none", "text") .
75  " WHERE glossary.id = " . $this->db->quote($glo_id, "integer")
76  );
77  $this->log("Convert glossary with id " . $glo_id . " into Standard Glossary.");
78  } else {
79  $this->db->manipulate(
80  "UPDATE glossary SET " .
81  " glossary.virtual = " . $this->db->quote("coll", "text") .
82  " WHERE glossary.id = " . $this->db->quote($glo_id, "integer")
83  );
84  $this->log("Convert glossary with id " . $glo_id . " into Collection Glossary.");
85  }
86 
87  $tmp_id = $glo_id;
88  }
89  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilGlossaryCollectionMigration::$db
protected

Definition at line 30 of file class.ilGlossaryCollectionMigration.php.


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