ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ilForumDatabaseUpdateSteps11 Class Reference
+ Inheritance diagram for ilForumDatabaseUpdateSteps11:
+ Collaboration diagram for ilForumDatabaseUpdateSteps11:

Public Member Functions

 prepare (ilDBInterface $db)
 
 step_1 ()
 
- Public Member Functions inherited from ilDatabaseUpdateSteps
 prepare (\ilDBInterface $db)
 Prepare the execution of the steps. More...
 

Protected Attributes

ilDBInterface $db
 

Detailed Description

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

Member Function Documentation

◆ prepare()

ilForumDatabaseUpdateSteps11::prepare ( ilDBInterface  $db)

Definition at line 25 of file class.ilForumDatabaseUpdateSteps11.php.

References $db.

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

◆ step_1()

ilForumDatabaseUpdateSteps11::step_1 ( )

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

References $res, ILIAS\Repository\int(), ilDBConstants\T_INTEGER, and ilDBConstants\T_TEXT.

30  : void
31  {
32  $res = $this->db->queryF(
33  "SELECT * FROM settings WHERE module = %s AND keyword = %s",
35  ['forum', 'frm_mod_tpl_perm_revocation']
36  );
37 
38  $row = $this->db->fetchAssoc($res);
39  if ($row) {
40  $this->db->manipulateF(
41  "DELETE FROM settings WHERE module = %s AND keyword = %s",
43  ['forum', 'frm_mod_tpl_perm_revocation']
44  );
45 
46  return;
47  }
48 
49  $res = $this->db->queryF(
50  "SELECT obj_id FROM object_data WHERE type = %s AND title = %s",
52  ['rolt', 'il_frm_moderator']
53  );
54 
55  $row = $this->db->fetchAssoc($res);
56  if (!isset($row['obj_id'])) {
57  return;
58  }
59 
60  $rol_id = (int) $row['obj_id'];
61 
62  $res = $this->db->query(
63  "SELECT ops_id FROM rbac_operations WHERE " . $this->db->in(
64  'operation',
65  ['edit_permission', 'delete', 'copy'],
66  false,
68  )
69  );
70 
71  $rows = $this->db->fetchAll($res);
72  if (!$rows) {
73  return;
74  }
75 
76  $operations_to_remove = [];
77  foreach ($rows as $row) {
78  $operations_to_remove[] = (int) $row['ops_id'];
79  }
80 
81  foreach ($operations_to_remove as $op_id) {
82  $this->db->manipulateF(
83  "DELETE FROM rbac_templates WHERE rol_id = %s AND type = %s AND ops_id = %s AND parent = %s",
85  [$rol_id, 'frm', $op_id, 8]
86  );
87  }
88  }
$res
Definition: ltiservices.php:66
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilForumDatabaseUpdateSteps11::$db
protected

Definition at line 23 of file class.ilForumDatabaseUpdateSteps11.php.

Referenced by prepare().


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