protected function get_stats()
{
if (strpos($this->db->get_sql_layer(), 'mysql') === false) {
$this->stats = array();
return;
}
$sql = 'SHOW INDEX
FROM ' . POSTS_TABLE;
$result = $this->db->sql_query($sql);
while ($row = $this->db->sql_fetchrow($result)) {
// deal with older MySQL versions which didn't use Index_type
$index_type = isset($row['Index_type']) ? $row['Index_type'] : $row['Comment'];
if ($index_type == 'FULLTEXT') {
if ($row['Key_name'] == 'post_subject') {
$this->stats['post_subject'] = $row;
} else {
if ($row['Key_name'] == 'post_content') {
$this->stats['post_content'] = $row;
}
}
}
}
$this->db->sql_freeresult($result);
$this->stats['total_posts'] = empty($this->stats) ? 0 : $this->db->get_estimated_row_count(POSTS_TABLE);
}