ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilForumDatabaseUpdateSteps11.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
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  $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  }
89 }
$res
Definition: ltiservices.php:66