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

Public Member Functions

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

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.ilMediaObjectsDBUpdateSteps.php.

Member Function Documentation

◆ prepare()

ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps::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.ilMediaObjectsDBUpdateSteps.php.

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

References ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps\$db.

◆ step_1()

ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps::step_1 ( )

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

33 : void
34 {
35 $db = $this->db;
36 if (!$db->tableColumnExists('media_item', 'duration')) {
37 $db->addTableColumn('media_item', 'duration', array(
38 "type" => "integer",
39 "notnull" => true,
40 "length" => 4,
41 "default" => 0
42 ));
43 }
44 }
addTableColumn(string $table_name, string $column_name, array $attributes)
tableColumnExists(string $table_name, string $column_name)

References ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps\$db, ilDBInterface\addTableColumn(), and ilDBInterface\tableColumnExists().

+ Here is the call graph for this function:

◆ step_2()

ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps::step_2 ( )

Definition at line 46 of file class.ilMediaObjectsDBUpdateSteps.php.

46 : void
47 {
48 // skipped, since added to ILIAS 8 later
49 }

◆ step_3()

ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps::step_3 ( )

Definition at line 51 of file class.ilMediaObjectsDBUpdateSteps.php.

51 : void
52 {
53 $db = $this->db;
54 $set = $db->queryF(
55 "SELECT * FROM settings " .
56 " WHERE module = %s AND keyword = %s ",
57 ["text", "text"],
58 ["mobs", "black_list_file_types"]
59 );
60 $black_list_str = "";
61 while ($rec = $db->fetchAssoc($set)) {
62 $black_list_str = $rec["value"] ?? "";
63 }
64 $black_list = explode(",", $black_list_str);
65 $new_black_list = [];
66 foreach ($black_list as $type) {
67 $type = strtolower(trim($type));
68 switch ($type) {
69 case "html": $type = "text/html";
70 break;
71 case "mp4": $type = "video/mp4";
72 break;
73 case "webm": $type = "video/webm";
74 break;
75 case "mp3": $type = "audio/mpeg";
76 break;
77 case "png": $type = "image/png";
78 break;
79 case "jpeg":
80 case "jpg": $type = "image/jpeg";
81 break;
82 case "gif": $type = "image/gif";
83 break;
84 case "webp": $type = "image/webp";
85 break;
86 case "svg": $type = "image/svg+xml";
87 break;
88 case "pdf": $type = "application/pdf";
89 break;
90 }
91 if (in_array($type, ["video/vimeo", "video/youtube", "video/mp4", "video/webm", "audio/mpeg",
92 "image/png", "image/jpeg", "image/gif", "image/webp", "image/svg+xml",
93 "text/html", "application/pdf"])) {
94 if (!in_array($type, $new_black_list)) {
95 $new_black_list[] = $type;
96 }
97 }
98 }
99 $db->update(
100 "settings",
101 [
102 "value" => ["text", implode(",", $new_black_list)]
103 ],
104 [ // where
105 "module" => ["text", "mobs"],
106 "keyword" => ["text", "black_list_file_types"]
107 ]
108 );
109 }
update(string $table_name, array $values, array $where)
@description $where MUST contain existing columns only.
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)

References ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps\$db, ilDBInterface\fetchAssoc(), ilDBInterface\queryF(), and ilDBInterface\update().

+ Here is the call graph for this function:

◆ step_4()

ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps::step_4 ( )

Definition at line 111 of file class.ilMediaObjectsDBUpdateSteps.php.

111 : void
112 {
113 $db = $this->db;
114 $db->modifyTableColumn('map_area', 'coords', ['length' => 4000]);
115 }
modifyTableColumn(string $table, string $column, array $attributes)

References ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps\$db, and ilDBInterface\modifyTableColumn().

+ Here is the call graph for this function:

◆ step_5()

ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps::step_5 ( )

Definition at line 117 of file class.ilMediaObjectsDBUpdateSteps.php.

117 : void
118 {
119 $db = $this->db;
120 $db->createTable('mob_data', [
121 "id" => [
122 "type" => "integer",
123 "notnull" => true,
124 "length" => 4,
125 "default" => 0
126 ],
127 "rid" => [
128 'type' => 'text',
129 'notnull' => true,
130 'length' => 64,
131 'default' => ""
132 ]
133 ]);
134 }
createTable(string $table_name, array $fields, bool $drop_table=false, bool $ignore_erros=false)

References ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps\$db, and ilDBInterface\createTable().

+ Here is the call graph for this function:

◆ step_6()

ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps::step_6 ( )

Definition at line 136 of file class.ilMediaObjectsDBUpdateSteps.php.

136 : void
137 {
138 $db = $this->db;
139 $db->addPrimaryKey("mob_data", ["id"]);
140 }
addPrimaryKey(string $table_name, array $primary_keys)

References ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps\$db, and ilDBInterface\addPrimaryKey().

+ Here is the call graph for this function:

◆ step_7()

ILIAS\MediaObjects\Setup\ilMediaObjectsDBUpdateSteps::step_7 ( )

Definition at line 142 of file class.ilMediaObjectsDBUpdateSteps.php.

142 : void
143 {
144 if (!$this->db->indexExistsByFields('media_item', ['mob_id'])) {
145 $this->db->addIndex('media_item', ['mob_id'], 'i1');
146 }
147 }

Field Documentation

◆ $db


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