ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
class.ilForumDatabaseUpdateSteps10.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 obj_id FROM object_data WHERE type = %s AND title = %s",
35  ['rolt', 'il_frm_moderator']
36  );
37 
38  $row = $this->db->fetchAssoc($res);
39  if (!isset($row['obj_id'])) {
40  return;
41  }
42 
43  $rol_id = (int) $row['obj_id'];
44 
45  $res = $this->db->query(
46  "SELECT ops_id FROM rbac_operations WHERE " . $this->db->in(
47  'operation',
48  ['edit_permission', 'delete', 'copy'],
49  false,
51  )
52  );
53 
54  $rows = $this->db->fetchAll($res);
55  if (!$rows) {
56  return;
57  }
58 
59  $operations_to_remove = [];
60  foreach ($rows as $row) {
61  $operations_to_remove[] = (int) $row['ops_id'];
62  }
63 
64  foreach ($operations_to_remove as $op_id) {
65  $this->db->manipulateF(
66  "DELETE FROM rbac_templates WHERE rol_id = %s AND type = %s AND ops_id = %s AND parent = %s",
68  [$rol_id, 'frm', $op_id, 8]
69  );
70  }
71 
72  $this->db->manipulateF(
73  "INSERT INTO settings (module, keyword, value) VALUES (%s, %s, %s)",
75  ['forum', 'frm_mod_tpl_perm_revocation', '1']
76  );
77  }
78 }
$res
Definition: ltiservices.php:69