ILIAS  release_8 Revision v8.23
ILIAS\COPage\Setup\ilCOPageDBUpdateSteps Class Reference
+ Inheritance diagram for ILIAS\COPage\Setup\ilCOPageDBUpdateSteps:
+ Collaboration diagram for ILIAS\COPage\Setup\ilCOPageDBUpdateSteps:

Public Member Functions

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

Protected Attributes

ilDBInterface $db
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 24 of file class.ilCOPageDBUpdateSteps.php.

Member Function Documentation

◆ prepare()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::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 28 of file class.ilCOPageDBUpdateSteps.php.

References ILIAS\COPage\Setup\ilCOPageDBUpdateSteps\$db.

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

◆ step_1()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_1 ( )

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

33  : void
34  {
35  $field = array(
36  'type' => 'integer',
37  'length' => 2,
38  'notnull' => true,
39  'default' => 0
40  );
41 
42  $this->db->modifyTableColumn("copg_pc_def", "order_nr", $field);
43  }

◆ step_2()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_2 ( )

Definition at line 45 of file class.ilCOPageDBUpdateSteps.php.

45  : void
46  {
47  $field = array(
48  'type' => 'integer',
49  'length' => 4,
50  'notnull' => true,
51  'default' => 0
52  );
53 
54  $this->db->modifyTableColumn("copg_pc_def", "order_nr", $field);
55  }

◆ step_3()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_3 ( )

Definition at line 57 of file class.ilCOPageDBUpdateSteps.php.

57  : void
58  {
59  $this->db->update(
60  "page_layout",
61  [
62  "title" => ["text", "Text page with accompanying media"]
63  ],
64  [ // where
65  "title" => ["text", "1A Simple text page with accompanying media"]
66  ]
67  );
68  $this->db->update(
69  "page_layout",
70  [
71  "title" => ["text", "Text page with accompanying media and test"]
72  ],
73  [ // where
74  "title" => ["text", "1C Text page with accompanying media and test"]
75  ]
76  );
77  $this->db->update(
78  "page_layout",
79  [
80  "title" => ["text", "Text page with accompanying media followed by test and text"]
81  ],
82  [ // where
83  "title" => ["text", "1E Text page with accompanying media followed by test and text"]
84  ]
85  );
86  $this->db->update(
87  "page_layout",
88  [
89  "title" => ["text", "Media page with accompanying text and test"]
90  ],
91  [ // where
92  "title" => ["text", "2C Simple media page with accompanying text and test"]
93  ]
94  );
95  $this->db->update(
96  "page_layout",
97  [
98  "title" => ["text", "Vertical component navigation page with media and text "]
99  ],
100  [ // where
101  "title" => ["text", "7C Vertical component navigation page with media and text"]
102  ]
103  );
104  }

◆ step_4()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_4 ( )

Definition at line 106 of file class.ilCOPageDBUpdateSteps.php.

106  : void
107  {
108  if (!$this->db->tableColumnExists('page_object', 'est_reading_time')) {
109  $this->db->addTableColumn('page_object', 'est_reading_time', array(
110  'type' => 'integer',
111  'notnull' => true,
112  'length' => 4,
113  'default' => 0
114  ));
115  }
116  }

◆ step_5()

ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::step_5 ( )

Definition at line 118 of file class.ilCOPageDBUpdateSteps.php.

118  : void
119  {
120  $set = $this->db->queryF(
121  "SELECT content FROM page_object " .
122  " WHERE page_id = %s AND parent_type = %s AND lang = %s",
123  ["integer", "text", "text"],
124  [5, "stys", "-"]
125  );
126  while ($rec = $this->db->fetchAssoc($set)) {
127  $content = $rec["content"];
128 
129  $replacements = [
130  ["a4e417c08feebeafb1487e60a2e245a4", "a4e417c08feebeafb1487e60a2e245a5"],
131  ["a4e417c08feebeafb1487e60a2e245a4", "a4e417c08feebeafb1487e60a2e245a6"],
132  ["a4e417c08feebeafb1487e60a2e245a5", "a4e417c08feebeafb1487e60a2e245a7"],
133  ["a4e417c08feebeafb1487e60a2e245a5", "a4e417c08feebeafb1487e60a2e245a8"]
134  ];
135 
136  foreach ($replacements as $r) {
137  $content = preg_replace('/' . $r[0] . '/', $r[1], $content, 1);
138  }
139 
140  $this->db->update(
141  "page_object",
142  [
143  "content" => ["clob", $content]
144  ],
145  [ // where
146  "page_id" => ["integer", 5],
147  "parent_type" => ["text", "stys"],
148  "lang" => ["text", '-'],
149  ]
150  );
151  }
152  }

Field Documentation

◆ $db

ilDBInterface ILIAS\COPage\Setup\ilCOPageDBUpdateSteps::$db
protected

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