Merge pull request #23585 from nextcloud/backport/23580/stable19

[stable19] Also expire share type email
This commit is contained in:
Roeland Jago Douma 2020-10-23 11:14:08 +02:00 committed by GitHub
commit bbc88ad708
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -24,6 +24,7 @@
namespace OCA\Files_Sharing; namespace OCA\Files_Sharing;
use OCP\Share\IShare;
use OC\BackgroundJob\TimedJob; use OC\BackgroundJob\TimedJob;
/** /**
@ -51,7 +52,7 @@ class ExpireSharesJob extends TimedJob {
$now = new \DateTime(); $now = new \DateTime();
$now = $now->format('Y-m-d H:i:s'); $now = $now->format('Y-m-d H:i:s');
/* /**
* Expire file link shares only (for now) * Expire file link shares only (for now)
*/ */
$qb = $connection->getQueryBuilder(); $qb = $connection->getQueryBuilder();
@ -59,7 +60,10 @@ class ExpireSharesJob extends TimedJob {
->from('share') ->from('share')
->where( ->where(
$qb->expr()->andX( $qb->expr()->andX(
$qb->expr()->eq('share_type', $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK)), $qb->expr()->orX(
$qb->expr()->eq('share_type', $qb->expr()->literal(IShare::TYPE_LINK)),
$qb->expr()->eq('share_type', $qb->expr()->literal(IShare::TYPE_EMAIL))
),
$qb->expr()->lte('expiration', $qb->expr()->literal($now)), $qb->expr()->lte('expiration', $qb->expr()->literal($now)),
$qb->expr()->orX( $qb->expr()->orX(
$qb->expr()->eq('item_type', $qb->expr()->literal('file')), $qb->expr()->eq('item_type', $qb->expr()->literal('file')),