ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Notes\Setup\ilNotesDBUpdateSteps Class Reference
+ Inheritance diagram for ILIAS\Notes\Setup\ilNotesDBUpdateSteps:
+ Collaboration diagram for ILIAS\Notes\Setup\ilNotesDBUpdateSteps:

Public Member Functions

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

Protected Attributes

ilDBInterface $db
 

Detailed Description

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

Member Function Documentation

◆ prepare()

ILIAS\Notes\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.

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

References ILIAS\Notes\Setup\ilNotesDBUpdateSteps\$db.

◆ step_1()

ILIAS\Notes\Setup\ilNotesDBUpdateSteps::step_1 ( )

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

30 : void
31 {
32 //
33 }

◆ step_2()

ILIAS\Notes\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\Notes\Setup\ilNotesDBUpdateSteps::step_3 ( )

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

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 }
replace(string $table, array $primary_keys, array $other_columns)
Replace into method.
quote($value, string $type)
manipulateF(string $query, array $types, array $values)
query(string $query)
Run a (read-only) Query on the database.
fetchAssoc(ilDBStatement $statement)
queryF(string $query, array $types, array $values)

References ILIAS\Notes\Setup\ilNotesDBUpdateSteps\$db, ilDBInterface\fetchAssoc(), ilDBInterface\manipulateF(), ilDBInterface\query(), ilDBInterface\queryF(), ilDBInterface\quote(), and ilDBInterface\replace().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ILIAS\Notes\Setup\ilNotesDBUpdateSteps::$db
protected

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