MCPcopy Create free account
hub / github.com/Rello/analytics / deleteAuditedShares

Method deleteAuditedShares

lib/Db/ShareMapper.php:336–355  ·  view source on GitHub ↗

Preserve the original deletion predicates, including recipient/owner checks. */

(IQueryBuilder $sql)

Source from the content-addressed store, hash-verified

334
335 /** Preserve the original deletion predicates, including recipient/owner checks. */
336 private function deleteAuditedShares(IQueryBuilder $sql): void
337 {
338 $statement = $sql->executeQuery();
339 $shares = $statement->fetchAll();
340 $statement->closeCursor();
341 foreach ($shares as $share) {
342 $delete = $this->db->getQueryBuilder();
343 $delete->delete(self::TABLE_NAME)
344 ->where($delete->expr()->eq('id', $delete->createNamedParameter($share['id'])));
345 // Do not revoke a share whose ownership or target changed since selection.
346 foreach (['uid_initiator', 'uid_owner', 'item_type', 'item_source', 'type'] as $field) {
347 $delete->andWhere($share[$field] === null
348 ? $delete->expr()->isNull($field)
349 : $delete->expr()->eq($field, $delete->createNamedParameter($share[$field])));
350 }
351 if ($delete->executeStatement() > 0) {
352 $this->auditShare('revoked', $share);
353 }
354 }
355 }
356
357 private function auditShare(string $action, array $share, array $changes = []): void
358 {

Callers 3

deleteShareMethod · 0.95
deleteSharesByItemMethod · 0.95
deleteByUserMethod · 0.95

Calls 3

auditShareMethod · 0.95
eqMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected