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

Public Member Functions

 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 
 step_1 ()
 
 step_2 ()
 
 step_3 ()
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

Definition at line 21 of file class.ilNotesDBUpdateSteps.php.

Member Function Documentation

◆ prepare()

ILIAS\Setup\ilNotesDBUpdateSteps::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 25 of file class.ilNotesDBUpdateSteps.php.

References ILIAS\Setup\ilNotesDBUpdateSteps\$db.

25  : void
26  {
27  $this->db = $db;
28  }

◆ step_1()

ILIAS\Setup\ilNotesDBUpdateSteps::step_1 ( )

Definition at line 30 of file class.ilNotesDBUpdateSteps.php.

30  : void
31  {
32  //
33  }

◆ step_2()

ILIAS\Setup\ilNotesDBUpdateSteps::step_2 ( )

Definition at line 35 of file class.ilNotesDBUpdateSteps.php.

35  : void
36  {
37  if (!$this->db->tableColumnExists('note', 'recipient')) {
38  $this->db->addTableColumn('note', 'recipient', array(
39  'type' => 'integer',
40  'notnull' => true,
41  'length' => 4,
42  'default' => 0
43  ));
44  }
45  }

◆ step_3()

ILIAS\Setup\ilNotesDBUpdateSteps::step_3 ( )

Definition at line 47 of file class.ilNotesDBUpdateSteps.php.

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

47  : void
48  {
49  $db = $this->db;
50  $set1 = $db->queryF(
51  "SELECT * FROM note_settings " .
52  " WHERE obj_type = %s AND obj_id = %s",
53  ["text", "integer"],
54  ["0", "0"]
55  );
56  while ($rec1 = $db->fetchAssoc($set1)) {
57  // get type
58  $set2 = $db->queryF(
59  "SELECT type FROM object_data " .
60  " WHERE obj_id = %s ",
61  ["integer"],
62  [$rec1["rep_obj_id"]]
63  );
64  if ($rec2 = $db->fetchAssoc($set2)) {
65 
66  // get activation with current query
67  $set3 = $db->query(
68  "SELECT rep_obj_id FROM note_settings " .
69  " WHERE rep_obj_id = " . $db->quote($rec1["rep_obj_id"], "integer") .
70  " AND activated = " . $db->quote(1, "integer")
71  );
72  $active = 0;
73  if ($db->fetchAssoc($set3)) {
74  $active = 1;
75  }
76  $db->replace(
77  "note_settings",
78  [
79  "rep_obj_id" => ["integer", $rec1["rep_obj_id"]],
80  "obj_id" => ["integer", $rec1["obj_id"]]
81  ],
82  [
83  "obj_type" => ["text", $rec2["type"]],
84  "activated" => ["integer", $active],
85  ]
86  );
88  "DELETE FROM note_settings WHERE " .
89  " rep_obj_id = %s AND obj_id = %s AND obj_type = %s",
90  ["integer", "integer", "text"],
91  [$rec1["rep_obj_id"], $rec1["obj_id"], $rec1["obj_type"]]
92  );
93 
94  }
95  }
96  }
manipulateF(string $query, array $types, array $values)
fetchAssoc(ilDBStatement $statement)
quote($value, string $type)
query(string $query)
Run a (read-only) Query on the database.
queryF(string $query, array $types, array $values)
replace(string $table, array $primary_keys, array $other_columns)
Replace into method.
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ILIAS\Setup\ilNotesDBUpdateSteps::$db
protected

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