mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-09 21:08:53 +00:00
[feature/avatars] Strictly check if avatar list is empty and cache result
PHPBB3-10018
This commit is contained in:
parent
9e001153d6
commit
cb08bf3c0c
1 changed files with 3 additions and 2 deletions
|
@ -142,6 +142,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of avatars that are locally available
|
* Get a list of avatars that are locally available
|
||||||
|
* Results get cached for 24 hours (86400 seconds)
|
||||||
*
|
*
|
||||||
* @return array Array containing the locally available avatars
|
* @return array Array containing the locally available avatars
|
||||||
*/
|
*/
|
||||||
|
@ -149,7 +150,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||||
{
|
{
|
||||||
$avatar_list = ($this->cache == null) ? false : $this->cache->get('avatar_local_list');
|
$avatar_list = ($this->cache == null) ? false : $this->cache->get('avatar_local_list');
|
||||||
|
|
||||||
if (!$avatar_list)
|
if ($avatar_list === false)
|
||||||
{
|
{
|
||||||
$avatar_list = array();
|
$avatar_list = array();
|
||||||
$path = $this->phpbb_root_path . $this->config['avatar_gallery_path'];
|
$path = $this->phpbb_root_path . $this->config['avatar_gallery_path'];
|
||||||
|
@ -185,7 +186,7 @@ class phpbb_avatar_driver_local extends phpbb_avatar_driver
|
||||||
|
|
||||||
if ($this->cache != null)
|
if ($this->cache != null)
|
||||||
{
|
{
|
||||||
$this->cache->put('avatar_local_list', $avatar_list);
|
$this->cache->put('avatar_local_list', $avatar_list, 86400);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue