ILIAS  trunk Revision v11.0_alpha-1831-g8615d53dadb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\Wiki\Setup\ilWikiDBUpdateSteps Class Reference
+ Inheritance diagram for ILIAS\Wiki\Setup\ilWikiDBUpdateSteps:
+ Collaboration diagram for ILIAS\Wiki\Setup\ilWikiDBUpdateSteps:

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 ()
 

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

Member Function Documentation

◆ prepare()

ILIAS\Wiki\Setup\ilWikiDBUpdateSteps::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.ilWikiDBUpdateSteps.php.

References ILIAS\Wiki\Setup\ilWikiDBUpdateSteps\$db.

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

◆ step_1()

ILIAS\Wiki\Setup\ilWikiDBUpdateSteps::step_1 ( )

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

References ILIAS\Wiki\Setup\ilWikiDBUpdateSteps\$db, and ilDBInterface\modifyTableColumn().

33  : void
34  {
35  $db = $this->db;
36  foreach (["int_links", "ext_links", "footnotes", "num_ratings", "num_words", "avg_rating", "deleted"] as $field) {
37  $db->modifyTableColumn('wiki_stat_page', $field, array(
38  'type' => 'integer',
39  'length' => 4,
40  'notnull' => true,
41  'default' => 0
42  ));
43  }
44  }
modifyTableColumn(string $table, string $column, array $attributes)
+ Here is the call graph for this function:

◆ step_2()

ILIAS\Wiki\Setup\ilWikiDBUpdateSteps::step_2 ( )

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

References ILIAS\Wiki\Setup\ilWikiDBUpdateSteps\$db, and ilDBInterface\modifyTableColumn().

46  : void
47  {
48  $db = $this->db;
49  foreach (["num_chars"] as $field) {
50  $db->modifyTableColumn('wiki_stat_page', $field, array(
51  'type' => 'integer',
52  'length' => 8,
53  'notnull' => true,
54  'default' => 0
55  ));
56  }
57  }
modifyTableColumn(string $table, string $column, array $attributes)
+ Here is the call graph for this function:

◆ step_3()

ILIAS\Wiki\Setup\ilWikiDBUpdateSteps::step_3 ( )

Definition at line 59 of file class.ilWikiDBUpdateSteps.php.

References ILIAS\Wiki\Setup\ilWikiDBUpdateSteps\$db, and ilDBInterface\modifyTableColumn().

59  : void
60  {
61  $db = $this->db;
62  foreach (["num_pages", "del_pages", "avg_rating"] as $field) {
63  $db->modifyTableColumn('wiki_stat', $field, array(
64  'type' => 'integer',
65  'length' => 4,
66  'notnull' => true,
67  'default' => 0
68  ));
69  }
70  }
modifyTableColumn(string $table, string $column, array $attributes)
+ Here is the call graph for this function:

◆ step_4()

ILIAS\Wiki\Setup\ilWikiDBUpdateSteps::step_4 ( )

Definition at line 72 of file class.ilWikiDBUpdateSteps.php.

References ILIAS\Wiki\Setup\ilWikiDBUpdateSteps\$db, and ilDBInterface\addTableColumn().

72  : void
73  {
74  $db = $this->db;
75  if (!$db->tableColumnExists('il_wiki_page', 'lang')) {
76  $this->db->addTableColumn('il_wiki_page', 'lang', array(
77  'type' => 'text',
78  'notnull' => true,
79  'length' => 10,
80  'default' => "-"
81  ));
82  $this->db->dropPrimaryKey('il_wiki_page');
83  $this->db->addPrimaryKey(
84  'il_wiki_page',
85  ["id", "lang"]
86  );
87  }
88  }
tableColumnExists(string $table_name, string $column_name)
addTableColumn(string $table_name, string $column_name, array $attributes)
+ Here is the call graph for this function:

◆ step_5()

ILIAS\Wiki\Setup\ilWikiDBUpdateSteps::step_5 ( )

Definition at line 90 of file class.ilWikiDBUpdateSteps.php.

References ILIAS\Wiki\Setup\ilWikiDBUpdateSteps\$db, and ilDBInterface\addTableColumn().

90  : void
91  {
92  $db = $this->db;
93  if (!$db->tableColumnExists('il_wiki_missing_page', 'lang')) {
94  $this->db->addTableColumn('il_wiki_missing_page', 'lang', array(
95  'type' => 'text',
96  'notnull' => true,
97  'length' => 5,
98  'default' => "-"
99  ));
100  $this->db->dropPrimaryKey('il_wiki_missing_page');
101  $this->db->addPrimaryKey(
102  'il_wiki_missing_page',
103  ["wiki_id", "source_id", "target_name", "lang"]
104  );
105  }
106  }
tableColumnExists(string $table_name, string $column_name)
addTableColumn(string $table_name, string $column_name, array $attributes)
+ Here is the call graph for this function:

◆ step_6()

ILIAS\Wiki\Setup\ilWikiDBUpdateSteps::step_6 ( )

Definition at line 108 of file class.ilWikiDBUpdateSteps.php.

References ILIAS\Wiki\Setup\ilWikiDBUpdateSteps\$db, and ilDBInterface\queryF().

108  : void
109  {
110  $db = $this->db;
111  $set = $db->queryF(
112  "SELECT * FROM il_wiki_data " .
113  " WHERE public_notes = %s ",
114  ["integer"],
115  [1]
116  );
117  while ($rec = $db->fetchAssoc($set)) {
118  $set2 = $db->queryF(
119  "SELECT * FROM note_settings " .
120  " WHERE rep_obj_id = %s AND obj_id = %s",
121  ["integer", "integer"],
122  [$rec["id"], 0]
123  );
124  if ($rec2 = $db->fetchAssoc($set2)) {
125  $db->update(
126  "note_settings",
127  [
128  "activated" => ["integer", 1]
129  ],
130  [ // where
131  "rep_obj_id" => ["integer", $rec["id"]],
132  "obj_id" => ["integer", 0]
133  ]
134  );
135  } else {
136  $db->insert("note_settings", [
137  "rep_obj_id" => ["integer", $rec["id"]],
138  "obj_id" => ["integer", 0],
139  "activated" => ["integer", 1],
140  "obj_type" => ["text", "wiki"]
141  ]);
142  }
143  }
144 
145  }
insert(string $table_name, array $values)
fetchAssoc(ilDBStatement $statement)
update(string $table_name, array $values, array $where)
$where MUST contain existing columns only.
queryF(string $query, array $types, array $values)
+ Here is the call graph for this function:

Field Documentation

◆ $db


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