summaryrefslogtreecommitdiffstats
path: root/lib/public/share.php
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2013-12-01 01:29:35 -0800
committerThomas Müller <thomas.mueller@tmit.eu>2013-12-01 01:29:35 -0800
commit832be7c908b99bcc5ff93305e638086cc5784dd9 (patch)
treea7c710696ed0b3dbc83b1dfbb654b82672c57616 /lib/public/share.php
parentc2b11cae83eb986f16253aa13f0b7cf494e1c680 (diff)
parent06df3822a0c52c44df4d5c8cc99576f5ac15864f (diff)
downloadnextcloud-server-832be7c908b99bcc5ff93305e638086cc5784dd9.tar.gz
nextcloud-server-832be7c908b99bcc5ff93305e638086cc5784dd9.zip
Merge pull request #6052 from owncloud/datetime-doctrine
Get rid of date strings for DB. Completely use Doctrine and DateTime.
Diffstat (limited to 'lib/public/share.php')
-rw-r--r--lib/public/share.php8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index d33b16148db..6dbcd5b67bf 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -827,11 +827,12 @@ class Share {
$date = null;
} else {
$date = new \DateTime($date);
- $date = date('Y-m-d H:i', $date->format('U') - $date->getOffset());
}
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?');
+ $query->bindValue(1, $date, 'datetime');
foreach ($items as $item) {
- $query->execute(array($date, $item['id']));
+ $query->bindValue(2, (int) $item['id']);
+ $query->execute();
}
return true;
}
@@ -847,7 +848,8 @@ class Share {
protected static function expireItem(array $item) {
if (!empty($item['expiration'])) {
$now = new \DateTime();
- $expirationDate = new \DateTime($item['expiration'], new \DateTimeZone('UTC'));
+ $expirationDate = \Doctrine\DBAL\Types\Type::getType('datetime')
+ ->convertToPhpValue($item['expiration'], \OC_DB::getConnection()->getDatabasePlatform());
if ($now > $expirationDate) {
self::unshareItem($item);
return true;