$share->getToken(),
$share->getPassword(),
$share->getSendPasswordByTalk(),
- $share->getHideDownload()
+ $share->getHideDownload(),
+ $share->getExpirationDate()
);
try {
* @param string $password
* @param bool $sendPasswordByTalk
* @param bool $hideDownload
+ * @param \DateTime|null $expirationTime
* @return int
*/
- protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload) {
+ protected function addShareToDB($itemSource, $itemType, $shareWith, $sharedBy, $uidOwner, $permissions, $token, $password, $sendPasswordByTalk, $hideDownload, $expirationTime) {
$qb = $this->dbConnection->getQueryBuilder();
$qb->insert('share')
->setValue('share_type', $qb->createNamedParameter(IShare::TYPE_EMAIL))
->setValue('stime', $qb->createNamedParameter(time()))
->setValue('hide_download', $qb->createNamedParameter((int)$hideDownload, IQueryBuilder::PARAM_INT));
+ if ($expirationTime !== null) {
+ $qb->setValue('expiration', $qb->createNamedParameter($expirationTime, IQueryBuilder::PARAM_DATE));
+ }
+
/*
* Added to fix https://github.com/owncloud/core/issues/22215
* Can be removed once we get rid of ajax/share.php
$password = 'password';
$sendPasswordByTalk = true;
$hideDownload = true;
+ $expiration = new \DateTime();
$instance = $this->getInstance();
$token,
$password,
$sendPasswordByTalk,
- $hideDownload
+ $hideDownload,
+ $expiration
]
);
$this->assertSame($password, $result[0]['password']);
$this->assertSame($sendPasswordByTalk, (bool)$result[0]['password_by_talk']);
$this->assertSame($hideDownload, (bool)$result[0]['hide_download']);
+ $this->assertSame($expiration->getTimestamp(), \DateTime::createFromFormat('Y-m-d H:i:s', $result[0]['expiration'])->getTimestamp());
}
public function testUpdate() {