ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilMediaCastDBUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\MediaCast\Setup;
20
25{
26 protected \ilDBInterface $db;
27
28 public function prepare(\ilDBInterface $db): void
29 {
30 $this->db = $db;
31 }
32
33 public function step_1(): void
34 {
35 $db = $this->db;
36 if (!$db->tableColumnExists('il_media_cast_data', 'autoplaymode')) {
37 $db->addTableColumn('il_media_cast_data', 'autoplaymode', array(
38 "type" => "integer",
39 "notnull" => true,
40 "length" => 1,
41 "default" => 0
42 ));
43 }
44 }
45
46 public function step_2(): void
47 {
48 $db = $this->db;
49 if (!$db->tableColumnExists('il_media_cast_data', 'nr_initial_videos')) {
50 $db->addTableColumn('il_media_cast_data', 'nr_initial_videos', array(
51 "type" => "integer",
52 "notnull" => true,
53 "length" => 1,
54 "default" => 0
55 ));
56 }
57 }
58
59 public function step_3(): void
60 {
61 $db = $this->db;
62 if (!$db->tableColumnExists('il_media_cast_data', 'new_items_in_lp')) {
63 $db->addTableColumn('il_media_cast_data', 'new_items_in_lp', array(
64 "type" => "integer",
65 "notnull" => true,
66 "length" => 1,
67 "default" => 1
68 ));
69 }
70 }
71
72 public function step_4(): void
73 {
74 $db = $this->db;
75 $analyzer = new \ilDBAnalyzer($db);
76 $info = $analyzer->getFieldInformation('settings');
77
78 if ($info['value']['type'] === 'clob') {
79 $type = 'clob';
80 } else {
81 $type = 'text';
82 }
83
84 $db = $this->db;
85
86 $db->manipulate("DELETE FROM settings WHERE keyword = " .
87 $db->quote("video_threshold", "text") . " AND module = " .
88 $db->quote("mcst", "text"));
89
90 $db->insert("settings", array(
91 "module" => array("text", "mcst"),
92 "keyword" => array("text", "video_threshold"),
93 "value" => array($type, "80")));
94 }
95}
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
$info
Definition: entry_point.php:21
Interface ilDBInterface.
addTableColumn(string $table_name, string $column_name, array $attributes)
insert(string $table_name, array $values)
quote($value, string $type)
manipulate(string $query)
Run a (write) Query on the database.
tableColumnExists(string $table_name, string $column_name)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: class.Agent.php:19