Properly format the share expiration time for the database, fixes bug oc-1779
This commit is contained in:
parent
2bdf89f4d4
commit
f967bfc956
|
@ -418,11 +418,16 @@ class Share {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setExpirationDate($itemType, $itemSource, $date) {
|
public static function setExpirationDate($itemType, $itemSource, $date) {
|
||||||
if ($item = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) {
|
if ($items = self::getItems($itemType, $itemSource, null, null, \OC_User::getUser(), self::FORMAT_NONE, null, -1, false)) {
|
||||||
error_log('setting');
|
if (!empty($items)) {
|
||||||
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?');
|
$date = new \DateTime($date);
|
||||||
$query->execute(array($date, $item['id']));
|
$date = date('Y-m-d H:i', $date->format('U') - $date->getOffset());
|
||||||
return true;
|
$query = \OC_DB::prepare('UPDATE `*PREFIX*share` SET `expiration` = ? WHERE `id` = ?');
|
||||||
|
foreach ($items as $item) {
|
||||||
|
$query->execute(array($date, $item['id']));
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue