[ticket/305] Simplify method get_global_id()
B3P-305
This commit is contained in:
@@ -442,6 +442,26 @@ class fetch_posts
|
||||
if ($this->type == 'announcements' && $this->global_id < 1)
|
||||
{
|
||||
if (!empty($this->where_string) || ($row = $this->cache->get('_forum_id_first_forum_post')) === false)
|
||||
{
|
||||
$row = $this->get_first_forum_id();
|
||||
}
|
||||
|
||||
if (empty($row))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$this->global_id = $row['forum_id'];
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first forum_id of FORUM_POST type forums
|
||||
*
|
||||
* @return array Database row of query
|
||||
*/
|
||||
protected function get_first_forum_id()
|
||||
{
|
||||
$sql = 'SELECT forum_id
|
||||
FROM ' . FORUMS_TABLE . '
|
||||
@@ -457,16 +477,8 @@ class fetch_posts
|
||||
// Cache first forum ID for one day = 86400 s
|
||||
$this->cache->put('_forum_id_first_forum_post', $row, 86400);
|
||||
}
|
||||
}
|
||||
|
||||
if (empty($row))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
$this->global_id = $row['forum_id'];
|
||||
}
|
||||
|
||||
return true;
|
||||
return $row;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user