Update only shares owned by the actor; audit only persisted changes. */
($shareId, string $field, $value, string $action)
| 307 | |
| 308 | /** Update only shares owned by the actor; audit only persisted changes. */ |
| 309 | private function updateShareField($shareId, string $field, $value, string $action): bool |
| 310 | { |
| 311 | $sql = $this->db->getQueryBuilder(); |
| 312 | $sql->select('id', 'item_type', 'item_source', 'type', 'uid_owner', 'uid_initiator', $field) |
| 313 | ->from(self::TABLE_NAME) |
| 314 | ->where($sql->expr()->eq('uid_initiator', $sql->createNamedParameter($this->userSession->getUser()->getUID()))) |
| 315 | ->andWhere($sql->expr()->eq('id', $sql->createNamedParameter($shareId))); |
| 316 | $statement = $sql->executeQuery(); |
| 317 | $share = $statement->fetch(); |
| 318 | $statement->closeCursor(); |
| 319 | if (!$share || (string)$share[$field] === (string)$value) { |
| 320 | return true; |
| 321 | } |
| 322 | |
| 323 | $sql->update(self::TABLE_NAME)->set($field, $sql->createNamedParameter($value)); |
| 324 | if ($sql->executeStatement() > 0) { |
| 325 | // Password material must never enter either the message or event parameters. |
| 326 | $changes = $field === 'password' ? [] : [ |
| 327 | 'previous' => $share[$field], |
| 328 | 'new' => $value, |
| 329 | ]; |
| 330 | $this->auditShare($action, $share, $changes); |
| 331 | } |
| 332 | return true; |
| 333 | } |
| 334 | |
| 335 | /** Preserve the original deletion predicates, including recipient/owner checks. */ |
| 336 | private function deleteAuditedShares(IQueryBuilder $sql): void |
no test coverage detected