ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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 38 of file class.ilGlossaryCollectionMigration.php.

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

◆ getLabel()

ilGlossaryCollectionMigration::getLabel ( )

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

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

◆ getPreconditions()

ilGlossaryCollectionMigration::getPreconditions ( Environment  $environment)

◆ getRemainingAmountOfSteps()

ilGlossaryCollectionMigration::getRemainingAmountOfSteps ( )

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

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

◆ log()

ilGlossaryCollectionMigration::log ( string  $str)
protected

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

Referenced by step().

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

◆ prepare()

ilGlossaryCollectionMigration::prepare ( Environment  $environment)

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

References ILIAS\Setup\Environment\getResource().

52  : void
53  {
54  $this->db = $environment->getResource(Environment::RESOURCE_DATABASE);
55  }
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 57 of file class.ilGlossaryCollectionMigration.php.

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

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

Field Documentation

◆ $db

ilDBInterface ilGlossaryCollectionMigration::$db
protected

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


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