56 : void
57 {
58 $set = $this->db->query(
59 "SELECT glossary_definition.id AS glo_def_id, glossary_definition.term_id AS glo_def_term_id, " .
60 " glossary_definition.short_text, glossary_definition.short_text_dirty, " .
61 " glossary_term.id AS glo_term_id, glossary_term.glo_id, glossary_term.term, glossary_term.language, " .
62 " glossary_term.create_date, glossary_term.last_update " .
63 " FROM glossary_definition JOIN glossary_term " .
64 " WHERE glossary_definition.term_id = glossary_term.id " .
65 " ORDER BY glossary_term.glo_id, glossary_term.id, glossary_definition.id"
66 );
67 $tmp = [];
68 while ($rec = $this->db->fetchAssoc($set)) {
69
70 if (!empty($tmp)
71 && $tmp["glo_id"] == $rec["glo_id"]
72 && $tmp["glo_term_id"] == $rec["glo_term_id"]
73 ) {
74 $new_term_id = $this->db->nextId('glossary_term');
75
76 $this->
log(
"Create new glossary term with id: " . $new_term_id);
77 $this->db->manipulate("INSERT INTO glossary_term (id, glo_id, term, language, import_id, create_date, last_update)" .
78 " VALUES (" .
79 $this->db->quote($new_term_id, "integer") . ", " .
80 $this->db->quote($rec["glo_id"], "integer") . ", " .
81 $this->db->quote($rec["term"], "text") . ", " .
82 $this->db->quote($rec["language"], "text") . "," .
83 $this->db->quote("", "text") . "," .
84 $this->db->quote($rec["create_date"], "text") . ", " .
85 $this->db->quote($rec["last_update"], "text") . ")");
86
87 $this->db->manipulate(
88 "UPDATE glossary_definition SET " .
89 " term_id = " . $this->db->quote($new_term_id, "integer") .
90 " WHERE id = " . $this->db->quote($rec["glo_def_id"], "integer")
91 );
92 }
93 $tmp["glo_id"] = $rec["glo_id"];
94 $tmp["glo_term_id"] = $rec["glo_term_id"];
95 }
96
97 $set = $this->db->query("SELECT * FROM glossary_definition WHERE migration = " . $this->db->quote("0", "integer"));
98 while ($rec = $this->db->fetchAssoc($set)) {
99
100 $this->
log(
"Add short text ('" . $rec[
"short_text"] .
"') and short text dirty ('" .
101 $rec["short_text_dirty"] . "') to glossary term with id: " . $rec["term_id"]);
102 $this->db->manipulate(
103 "UPDATE glossary_term SET " .
104 " short_text = " . $this->db->quote($rec["short_text"], "text") . ", " .
105 " short_text_dirty = " . $this->db->quote($rec["short_text_dirty"], "integer") .
106 " WHERE id = " . $this->db->quote($rec["term_id"], "integer")
107 );
108
109 $this->
log(
"Update id and type ('gdf' to 'term') for page object with id: " . $rec[
"id"]);
110 $this->db->manipulate(
111 "UPDATE page_object SET " .
112 " page_id = " . $this->db->quote($rec["term_id"], "integer") . ", " .
113 " parent_type = " . $this->db->quote("term", "text") .
114 " WHERE parent_type = " . $this->db->quote("gdf", "text") .
115 " AND page_id = " . $this->db->quote($rec["id"], "integer")
116 );
117
118 $this->db->manipulate(
119 "UPDATE glossary_definition SET " .
120 " migration = " . $this->db->quote("1", "integer") .
121 " WHERE id = " . $this->db->quote($rec["id"], "integer")
122 );
123 }
124
125
126 $this->
log(
"Update type ('gdf' to 'term') for page object definition.");
127 $this->db->manipulate(
128 "UPDATE copg_pobj_def SET " .
129 " parent_type = " . $this->db->quote("term", "text") .
130 " WHERE parent_type = " . $this->db->quote("gdf", "text")
131 );
132 }