ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\AdvancedMetaData\Setup\DBUpdateSteps8 Class Reference
+ Inheritance diagram for ILIAS\AdvancedMetaData\Setup\DBUpdateSteps8:
+ Collaboration diagram for ILIAS\AdvancedMetaData\Setup\DBUpdateSteps8:

Public Member Functions

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

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\AdvancedMetaData\Setup\DBUpdateSteps8::migrate ( int  $id,
int  $field_id,
  $data 
)
private

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

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

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

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

+ Here is the caller graph for this function:

◆ migrateData()

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

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

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:69

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

+ Here is the call graph for this function:

◆ prepare()

ILIAS\AdvancedMetaData\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.

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

References ILIAS\AdvancedMetaData\Setup\DBUpdateSteps8\$db.

◆ step_1()

ILIAS\AdvancedMetaData\Setup\DBUpdateSteps8::step_1 ( )

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

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 }

◆ step_2()

ILIAS\AdvancedMetaData\Setup\DBUpdateSteps8::step_2 ( )

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

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 }

◆ step_3()

ILIAS\AdvancedMetaData\Setup\DBUpdateSteps8::step_3 ( )

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

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 }

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

+ Here is the call graph for this function:

◆ step_4()

ILIAS\AdvancedMetaData\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\AdvancedMetaData\Setup\DBUpdateSteps8::$db
private

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