protected function run($argument) { $remote = $argument['remote']; $id = (int) $argument['id']; $token = $argument['token']; $try = (int) $argument['try'] + 1; $result = $this->notifications->sendRemoteUnShare($remote, $id, $token, $try); if ($result === true || $try > $this->maxTry) { $this->retainJob = false; } }
/** * Delete a share (owner unShares the file) * * @param IShare $share */ public function delete(IShare $share) { list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith()); $isOwner = false; // if the local user is the owner we can send the unShare request directly... if ($this->userManager->userExists($share->getShareOwner())) { $this->notifications->sendRemoteUnShare($remote, $share->getId(), $share->getToken()); $this->revokeShare($share, true); $isOwner = true; } else { // ... if not we need to correct ID for the unShare request $remoteId = $this->getRemoteId($share); $this->notifications->sendRemoteUnShare($remote, $remoteId, $share->getToken()); $this->revokeShare($share, false); } // send revoke notification to the other user, if initiator and owner are not the same user if ($share->getShareOwner() !== $share->getSharedBy()) { $remoteId = $this->getRemoteId($share); if ($isOwner) { list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedBy()); } else { list(, $remote) = $this->addressHandler->splitUserRemote($share->getShareOwner()); } $this->notifications->sendRevokeShare($remote, $remoteId, $share->getToken()); } $this->removeShareFromTable($share); }
/** * Delete a share * * @param IShare $share */ public function delete(IShare $share) { $qb = $this->dbConnection->getQueryBuilder(); $qb->delete('share')->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))); $qb->execute(); list(, $remote) = $this->addressHandler->splitUserRemote($share->getSharedWith()); $this->notifications->sendRemoteUnShare($remote, $share->getId(), $share->getToken()); }