mirror of
https://github.com/owncloudarchive/contacts.git
synced 2024-11-29 11:24:11 +01:00
Allow address book list to be cached.
This commit is contained in:
parent
5bc8e08c6c
commit
5f17dc9b5e
@ -30,13 +30,24 @@ class AddressBookController extends BaseController {
|
||||
$app = new App($this->api->getUserId());
|
||||
$addressBooks = $app->getAddressBooksForUser();
|
||||
$response = array();
|
||||
$lastModified = 0;
|
||||
foreach($addressBooks as $addressBook) {
|
||||
$response[] = $addressBook->getMetaData();
|
||||
$data = $addressBook->getMetaData();
|
||||
$response[] = $data;
|
||||
if(!is_null($data['lastmodified'])) {
|
||||
$lastModified = max($lastModified, $data['lastmodified']);
|
||||
}
|
||||
$response = new JSONResponse(
|
||||
array(
|
||||
}
|
||||
|
||||
$response = new JSONResponse(array(
|
||||
'addressbooks' => $response,
|
||||
));
|
||||
|
||||
if($lastModified > 0) {
|
||||
$response->setLastModified(\DateTime::createFromFormat('U', $lastModified) ?: null);
|
||||
$response->setETag(md5($lastModified));
|
||||
}
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user