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

Public Member Functions

 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 
 step_1 ()
 
 step_2 ()
 
 step_3 ()
 
 step_4 ()
 

Private Member Functions

 migrate (int $id, int $field_id, $data)
 
 migrateData (int $field_id, $data)
 

Private Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 23 of file class.DBUpdateSteps8.php.

Member Function Documentation

◆ migrate()

ILIAS\Setup\DBUpdateSteps8::migrate ( int  $id,
int  $field_id,
  $data 
)
private

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

References $data, ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

Referenced by ILIAS\Setup\DBUpdateSteps8\step_3().

56  : void
57  {
58  $query = 'UPDATE pg_amd_page_list ' .
59  'SET sdata = ' . $this->db->quote(serialize(serialize($data)), \ilDBConstants::T_TEXT) . ' ' .
60  'WHERE id = ' . $this->db->quote($id, \ilDBConstants::T_INTEGER) . ' ' .
61  'AND field_id = ' . $this->db->quote($field_id, \ilDBConstants::T_INTEGER);
62  $this->db->manipulate($query);
63  }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the caller graph for this function:

◆ migrateData()

ILIAS\Setup\DBUpdateSteps8::migrateData ( int  $field_id,
  $data 
)
private

Definition at line 65 of file class.DBUpdateSteps8.php.

References $data, $res, ilDBConstants\FETCHMODE_OBJECT, ILIAS\Repository\int(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

65  : array
66  {
67  if (!is_array($data)) {
68  return [];
69  }
70  $indexes = [];
71  foreach ($data as $idx => $value) {
72  $query = 'SELECT idx from adv_mdf_enum ' .
73  'WHERE value = ' . $this->db->quote($value, \ilDBConstants::T_TEXT) . ' ' .
74  'AND field_id = ' . $this->db->quote($field_id, \ilDBConstants::T_INTEGER);
75  $res = $this->db->query($query);
76 
77  $found_index = false;
78  while ($row = $res->fetchRow(\ilDBConstants::FETCHMODE_OBJECT)) {
79  $indexes[] = (int) $row->idx;
80  $found_index = true;
81  }
82  if ($found_index) {
83  continue;
84  }
85  $query = 'SELECT idx from adv_mdf_enum ' .
86  'WHERE idx = ' . $this->db->quote($value, \ilDBConstants::T_TEXT) . ' ' .
87  'AND field_id = ' . $this->db->quote($field_id, \ilDBConstants::T_INTEGER);
88  $res = $this->db->query($query);
89  while ($row = $res->fetchRow(\ilDBConstants::FETCHMODE_OBJECT)) {
90  $indexes[] = (int) $row->idx;
91  }
92  }
93  return $indexes;
94  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

◆ prepare()

ILIAS\Setup\DBUpdateSteps8::prepare ( \ilDBInterface  $db)

Prepare the execution of the steps.

Do not use anything from the globals or the DIC inside your steps, only use the instance of the database provided here.

Implements ilDatabaseUpdateSteps.

Definition at line 27 of file class.DBUpdateSteps8.php.

References ILIAS\Setup\DBUpdateSteps8\$db.

27  : void
28  {
29  $this->db = $db;
30  }

◆ step_1()

ILIAS\Setup\DBUpdateSteps8::step_1 ( )

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

References null.

32  : void
33  {
34  if ($this->db->tableColumnExists('adv_mdf_definition', 'field_values')) {
35  $field_infos = [
36  'type' => 'clob',
37  'notnull' => false,
38  'default' => null
39  ];
40  $this->db->modifyTableColumn('adv_mdf_definition', 'field_values', $field_infos);
41  }
42  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ step_2()

ILIAS\Setup\DBUpdateSteps8::step_2 ( )

Definition at line 44 of file class.DBUpdateSteps8.php.

References null.

44  : void
45  {
46  if (!$this->db->tableColumnExists('pg_amd_page_list', 'sdata')) {
47  $field_infos = [
48  'type' => 'clob',
49  'notnull' => false,
50  'default' => null
51  ];
52  $this->db->addTableColumn('pg_amd_page_list', 'sdata', $field_infos);
53  }
54  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null

◆ step_3()

ILIAS\Setup\DBUpdateSteps8::step_3 ( )

Definition at line 98 of file class.DBUpdateSteps8.php.

References $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Setup\DBUpdateSteps8\migrate().

98  : void
99  {
100  $query = 'SELECT id, pg.field_id, data, field_type FROM pg_amd_page_list pg ' .
101  'JOIN adv_mdf_definition adv ' .
102  'ON pg.field_id = adv.field_id ' .
103  'WHERE sdata IS null ';
104  $res = $this->db->query($query);
105  while ($row = $res->fetchRow(\ilDBConstants::FETCHMODE_OBJECT)) {
106  if ($row->field_type == 1 || $row->field_type == 8) {
107  $this->migrate(
108  (int) $row->id,
109  (int) $row->field_id,
110  $this->migrateData(
111  (int) $row->field_id,
112  unserialize(unserialize($row->data))
113  )
114  );
115  } else {
116  $this->migrate(
117  (int) $row->id,
118  (int) $row->field_id,
119  unserialize(unserialize($row->data))
120  );
121  }
122  }
123  }
$res
Definition: ltiservices.php:66
migrate(int $id, int $field_id, $data)
+ Here is the call graph for this function:

◆ step_4()

ILIAS\Setup\DBUpdateSteps8::step_4 ( )

Definition at line 125 of file class.DBUpdateSteps8.php.

125  : void
126  {
127  $this->db->modifyTableColumn(
128  'adv_md_values_extlink',
129  'value',
130  [
131  'type' => 'text',
132  'length' => 2000,
133  'notnull' => false
134  ]
135  );
136  }

Field Documentation

◆ $db

ilDBInterface ILIAS\Setup\DBUpdateSteps8::$db
private

Definition at line 25 of file class.DBUpdateSteps8.php.

Referenced by ILIAS\Setup\DBUpdateSteps8\prepare().


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