| @@ 107-137 (lines=31) @@ | ||
| 104 | /** |
|
| 105 | * Install module |
|
| 106 | */ |
|
| 107 | public function _install() { |
|
| 108 | $this->load->dbforge(); |
|
| 109 | ($this->dx_auth->is_admin()) OR exit; |
|
| 110 | ||
| 111 | $fields = [ |
|
| 112 | 'id' => [ |
|
| 113 | 'type' => 'INT', |
|
| 114 | 'auto_increment' => TRUE |
|
| 115 | ], |
|
| 116 | 'component' => [ |
|
| 117 | 'type' => 'VARCHAR', |
|
| 118 | 'constraint' => '255', |
|
| 119 | 'null' => FALSE |
|
| 120 | ], |
|
| 121 | 'key' => [ |
|
| 122 | 'type' => 'Text', |
|
| 123 | 'null' => TRUE |
|
| 124 | ], |
|
| 125 | 'data' => [ |
|
| 126 | 'type' => 'TEXT', |
|
| 127 | 'null' => TRUE |
|
| 128 | ] |
|
| 129 | ]; |
|
| 130 | ||
| 131 | $this->dbforge->add_field($fields); |
|
| 132 | $this->dbforge->add_key('id', TRUE); |
|
| 133 | $this->dbforge->create_table('template_settings'); |
|
| 134 | ||
| 135 | $this->db->where('name', 'template_manager'); |
|
| 136 | $this->db->update('components', ['enabled' => 1, 'autoload' => 1]); |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * Deinstall module |
|
| @@ 198-230 (lines=33) @@ | ||
| 195 | /** |
|
| 196 | * Install module |
|
| 197 | */ |
|
| 198 | public function _install() { |
|
| 199 | ||
| 200 | $this->load->dbforge(); |
|
| 201 | ($this->dx_auth->is_admin()) OR exit; |
|
| 202 | $fields = [ |
|
| 203 | 'id' => [ |
|
| 204 | 'type' => 'INT', |
|
| 205 | 'auto_increment' => TRUE, |
|
| 206 | ], |
|
| 207 | 'id_type' => [ |
|
| 208 | 'type' => 'VARCHAR', |
|
| 209 | 'constraint' => '25', |
|
| 210 | 'null' => TRUE, |
|
| 211 | ], |
|
| 212 | 'type' => [ |
|
| 213 | 'type' => 'VARCHAR', |
|
| 214 | 'constraint' => '25', |
|
| 215 | 'null' => TRUE, |
|
| 216 | ], |
|
| 217 | 'votes' => ['type' => 'INT'], |
|
| 218 | 'rating' => ['type' => 'INT'], |
|
| 219 | ]; |
|
| 220 | ||
| 221 | $this->dbforge->add_field($fields); |
|
| 222 | $this->dbforge->add_key('id', TRUE); |
|
| 223 | $this->dbforge->create_table('rating'); |
|
| 224 | ||
| 225 | $this->db->where('name', 'star_rating'); |
|
| 226 | $this->db->update('components', ['enabled' => 1]); |
|
| 227 | } |
|
| 228 | ||
| 229 | /** |
|
| 230 | * Deinstall module |
|
| 231 | */ |
|
| 232 | public function _deinstall() { |
|
| 233 | ||