mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 08:53:37 +01:00
* Addressbook - fix birthday cache was not cleared when birthday edited
This commit is contained in:
parent
68b83de1ec
commit
4024db8353
@ -1053,15 +1053,30 @@ class Contacts extends Contacts\Storage
|
|||||||
if($isUpdate && $old['bday'] !== $to_write['bday'] || !$isUpdate && $to_write['bday'])
|
if($isUpdate && $old['bday'] !== $to_write['bday'] || !$isUpdate && $to_write['bday'])
|
||||||
{
|
{
|
||||||
$year = (int) date('Y',time());
|
$year = (int) date('Y',time());
|
||||||
Cache::unsetInstance(__CLASS__,"birthday-$year-{$to_write['owner']}");
|
$this->clear_birthday_cache($year, $to_write['owner']);
|
||||||
$year++;
|
$year++;
|
||||||
Cache::unsetInstance(__CLASS__,"birthday-$year-{$to_write['owner']}");
|
$this->clear_birthday_cache($year, $to_write['owner']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->error ? false : $contact['id'];
|
return $this->error ? false : $contact['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Since birthdays are cached for the instance for BIRTHDAY_CACHE_TIME, we
|
||||||
|
* need to clear them if a birthday changes.
|
||||||
|
*
|
||||||
|
* @param type $year
|
||||||
|
*/
|
||||||
|
protected function clear_birthday_cache($year, $owner)
|
||||||
|
{
|
||||||
|
// Cache is kept per-language, so clear them all
|
||||||
|
foreach(array_keys(Translation::get_installed_langs()) as $lang)
|
||||||
|
{
|
||||||
|
Cache::unsetInstance(__CLASS__,"birthday-$year-{$owner}-$lang");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resize photo down to 240pixel width and returns it
|
* Resize photo down to 240pixel width and returns it
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user