ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilHelpDBUpdateSteps.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\Help\Setup;
20
22{
23 protected \ilDBInterface $db;
24
25 public function prepare(\ilDBInterface $db): void
26 {
27 $this->db = $db;
28 }
29
30 public function step_1(): void
31 {
32 if (!$this->db->tableColumnExists('help_module', 'order_nr')) {
33 $this->db->addTableColumn('help_module', 'order_nr', array(
34 'type' => 'integer',
35 'notnull' => true,
36 'length' => 4,
37 'default' => 0
38 ));
39 }
40 }
41
42 public function step_2(): void
43 {
44 if (!$this->db->tableColumnExists('help_module', 'active')) {
45 $this->db->addTableColumn('help_module', 'active', array(
46 'type' => 'integer',
47 'notnull' => true,
48 'length' => 1,
49 'default' => 0
50 ));
51 }
52 }
53
54 public function step_3(): void
55 {
56 $set = $this->db->queryF(
57 "SELECT value FROM settings " .
58 " WHERE module = %s AND keyword = %s",
59 ["text", "text"],
60 ["common", "help_module"]
61 );
62 if ($rec = $this->db->fetchAssoc($set)) {
63 $id = (int) $rec["value"];
64 if ($id > 0) {
65 $this->db->update(
66 "help_module",
67 [
68 "active" => ["integer", 1]
69 ],
70 [ // where
71 "id" => ["integer", $id]
72 ]
73 );
74 }
75 }
76 }
77
78 public function step_4(): void
79 {
80 if (!$this->db->tableColumnExists('help_map', 'full_id')) {
81 $this->db->addTableColumn('help_map', 'full_id', array(
82 'type' => 'text',
83 'length' => 1000,
84 'default' => ""
85 ));
86 }
87 }
88
89}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
prepare(\ilDBInterface $db)
Prepare the execution of the steps.
Interface ilDBInterface.
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:21