ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWOPIDB90.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
25{
26 private ?ilDBInterface $db = null;
27
28 public function prepare(ilDBInterface $db): void
29 {
30 $this->db = $db;
31 }
32
33 public function step_1(): void
34 {
35 // create app table
36 $this->db->createTable('wopi_app', [
37 'id' => [
38 'type' => 'integer',
39 'length' => 4,
40 'notnull' => true,
41 ],
42 'name' => [
43 'type' => 'text',
44 'length' => 256,
45 'notnull' => true,
46 ],
47 'favicon' => [
48 'type' => 'text',
49 'length' => 256,
50 'notnull' => false,
51 ],
52 ]);
53 $this->db->addPrimaryKey('wopi_app', ['id']);
54 $this->db->createSequence('wopi_app');
55 }
56
57 public function step_2(): void
58 {
59 // create action table
60 $this->db->createTable('wopi_action', [
61 'id' => [
62 'type' => 'integer',
63 'length' => 4,
64 'notnull' => true,
65 ],
66 'app_id' => [
67 'type' => 'integer',
68 'length' => 4,
69 'notnull' => true,
70 ],
71 'name' => [
72 'type' => 'text',
73 'length' => 256,
74 'notnull' => true,
75 ],
76 'ext' => [
77 'type' => 'text',
78 'length' => 256,
79 'notnull' => true,
80 ],
81 'urlsrc' => [
82 'type' => 'text',
83 'length' => 2048,
84 'notnull' => true,
85 ]
86 ]);
87 $this->db->addPrimaryKey('wopi_action', ['id']);
88 $this->db->createSequence('wopi_action');
89 $this->db->addIndex('wopi_action', ['app_id'], 'i1');
90 }
91
92 public function step_3(): void
93 {
94 if (!$this->db->tableColumnExists('wopi_action', 'url_appendix')) {
95 $this->db->addTableColumn(
96 'wopi_action',
97 'url_appendix',
98 [
99 'type' => 'text',
100 'length' => 4000,
101 'notnull' => false,
102 ]
103 );
104 }
105 }
106
107 public function step_4(): void
108 {
109 if (!$this->db->tableColumnExists('wopi_action', 'target_ext')) {
110 $this->db->addTableColumn(
111 'wopi_action',
112 'target_ext',
113 [
114 'type' => 'text',
115 'length' => 256,
116 'notnull' => false,
117 ],
118 );
119 }
120 }
121}
prepare(ilDBInterface $db)
ilDBInterface $db
Interface ilDBInterface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...