3 declare(strict_types=1);
    35         return "Migration of glossary definitions after abolition of multiple definitions";
    40         return Migration::INFINITE;
    54         $this->db = $environment->
getResource(Environment::RESOURCE_DATABASE);
    59         $set = $this->db->query(
    60             "SELECT glossary_definition.id AS glo_def_id, glossary_definition.term_id AS glo_def_term_id, " .
    61             " glossary_definition.short_text, glossary_definition.short_text_dirty, " .
    62             " glossary_term.id AS glo_term_id, glossary_term.glo_id, glossary_term.term, glossary_term.language, " .
    63             " glossary_term.create_date, glossary_term.last_update " .
    64             " FROM glossary_definition JOIN glossary_term " .
    65             " WHERE glossary_definition.term_id = glossary_term.id " .
    66             " ORDER BY glossary_term.glo_id, glossary_term.id, glossary_definition.id"    69         while ($rec = $this->db->fetchAssoc($set)) {
    72                 && $tmp[
"glo_id"] == $rec[
"glo_id"]
    73                 && $tmp[
"glo_term_id"] == $rec[
"glo_term_id"]
    75                 $new_term_id = $this->db->nextId(
'glossary_term');
    77                 $this->
log(
"Create new glossary term with id: " . $new_term_id);
    78                 $this->db->manipulate(
"INSERT INTO glossary_term (id, glo_id, term, language, import_id, create_date, last_update)" .
    80                     $this->db->quote($new_term_id, 
"integer") . 
", " .
    81                     $this->db->quote($rec[
"glo_id"], 
"integer") . 
", " .
    82                     $this->db->quote($rec[
"term"], 
"text") . 
", " .
    83                     $this->db->quote($rec[
"language"], 
"text") . 
"," .
    84                     $this->db->quote(
"", 
"text") . 
"," .
    85                     $this->db->quote($rec[
"create_date"], 
"text") . 
", " .
    86                     $this->db->quote($rec[
"last_update"], 
"text") . 
")");
    88                 $this->db->manipulate(
    89                     "UPDATE glossary_definition SET " .
    90                     " term_id = " . $this->db->quote($new_term_id, 
"integer") .
    91                     " WHERE id = " . $this->db->quote($rec[
"glo_def_id"], 
"integer")
    94             $tmp[
"glo_id"] = $rec[
"glo_id"];
    95             $tmp[
"glo_term_id"] = $rec[
"glo_term_id"];
    98         $set = $this->db->query(
"SELECT * FROM glossary_definition WHERE migration = " . $this->db->quote(
"0", 
"integer"));
    99         while ($rec = $this->db->fetchAssoc($set)) {
   101             $this->
log(
"Add short text ('" . $rec[
"short_text"] . 
"') and short text dirty ('" .
   102                 $rec[
"short_text_dirty"] . 
"') to glossary term with id: " . $rec[
"term_id"]);
   103             $this->db->manipulate(
   104                 "UPDATE glossary_term SET " .
   105                 " short_text = " . $this->db->quote($rec[
"short_text"], 
"text") . 
", " .
   106                 " short_text_dirty = " . $this->db->quote($rec[
"short_text_dirty"], 
"integer") .
   107                 " WHERE id = " . $this->db->quote($rec[
"term_id"], 
"integer")
   110             $this->
log(
"Update id and type ('gdf' to 'term') for page object with id: " . $rec[
"id"]);
   111             $this->db->manipulate(
   112                 "UPDATE page_object SET " .
   113                 " page_id = " . $this->db->quote($rec[
"term_id"], 
"integer") . 
", " .
   114                 " parent_type = " . $this->db->quote(
"term", 
"text") .
   115                 " WHERE parent_type = " . $this->db->quote(
"gdf", 
"text") .
   116                 " AND page_id = " . $this->db->quote($rec[
"id"], 
"integer")
   119             $this->db->manipulate(
   120                 "UPDATE glossary_definition SET " .
   121                 " migration = " . $this->db->quote(
"1", 
"integer") .
   122                 " WHERE id = " . $this->db->quote($rec[
"id"], 
"integer")
   127         $this->
log(
"Update type ('gdf' to 'term') for page object definition.");
   128         $this->db->manipulate(
   129             "UPDATE copg_pobj_def SET " .
   130             " parent_type = " . $this->db->quote(
"term", 
"text") .
   131             " WHERE parent_type = " . $this->db->quote(
"gdf", 
"text")
   135     protected function log(
string $str): void
   142         $this->db->manipulate($query);
   148         $set = $this->db->query(
   149             "SELECT glossary_definition.id AS glo_def_id, glossary_definition.term_id AS glo_def_term_id, " .
   150             " glossary_definition.short_text, glossary_definition.short_text_dirty, " .
   151             " glossary_term.id AS glo_term_id, glossary_term.glo_id, glossary_term.term, glossary_term.language, " .
   152             " glossary_term.create_date, glossary_term.last_update " .
   153             " FROM glossary_definition JOIN glossary_term " .
   154             " WHERE glossary_definition.term_id = glossary_term.id " .
   155             " ORDER BY glossary_term.glo_id, glossary_term.id, glossary_definition.id"   158         while ($rec = $this->db->fetchAssoc($set)) {
   161                 && $tmp[
"glo_id"] == $rec[
"glo_id"]
   162                 && $tmp[
"glo_term_id"] == $rec[
"glo_term_id"]
   166             $tmp[
"glo_id"] = $rec[
"glo_id"];
   167             $tmp[
"glo_term_id"] = $rec[
"glo_term_id"];
   170         $set = $this->db->query(
"SELECT * FROM glossary_definition WHERE migration = " . $this->db->quote(
"0", 
"integer"));
   171         if ($rec = $this->db->fetchAssoc($set)) {
   175         $set = $this->db->query(
"SELECT parent_type FROM copg_pobj_def WHERE parent_type = " . $this->db->quote(
"gdf", 
"text"));
   176         if ($rec = $this->db->fetchAssoc($set)) {
 
getPreconditions(Environment $environment)
 
manipulate(string $query)
 
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g. 
 
prepare(Environment $environment)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
An environment holds resources to be used in the setup process. 
 
step(Environment $environment)
 
getRemainingAmountOfSteps()
 
getDefaultAmountOfStepsPerRun()