mirror of
https://github.com/phpbb/phpbb.git
synced 2025-07-23 18:11:47 +02:00
[feature/avatars] Strictly check if avatar list is empty and cache result
PHPBB3-10018
This commit is contained in:
@@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user