phpbb\search\fulltext_mysql::init PHP Method

init() public method

Checks for correct MySQL version and stores min/max word length in the config
public init ( ) : string | boolean
return string | boolean Language key of the error/incompatiblity occurred
    public function init()
    {
        if ($this->db->get_sql_layer() != 'mysql4' && $this->db->get_sql_layer() != 'mysqli') {
            return $this->user->lang['FULLTEXT_MYSQL_INCOMPATIBLE_DATABASE'];
        }
        $result = $this->db->sql_query('SHOW TABLE STATUS LIKE \'' . POSTS_TABLE . '\'');
        $info = $this->db->sql_fetchrow($result);
        $this->db->sql_freeresult($result);
        $engine = '';
        if (isset($info['Engine'])) {
            $engine = $info['Engine'];
        } else {
            if (isset($info['Type'])) {
                $engine = $info['Type'];
            }
        }
        $fulltext_supported = $engine === 'MyISAM' || $engine === 'InnoDB' && phpbb_version_compare($this->db->sql_server_info(true), '5.6.4', '>=');
        if (!$fulltext_supported) {
            return $this->user->lang['FULLTEXT_MYSQL_NOT_SUPPORTED'];
        }
        $sql = 'SHOW VARIABLES
			LIKE \'ft\\_%\'';
        $result = $this->db->sql_query($sql);
        $mysql_info = array();
        while ($row = $this->db->sql_fetchrow($result)) {
            $mysql_info[$row['Variable_name']] = $row['Value'];
        }
        $this->db->sql_freeresult($result);
        $this->config->set('fulltext_mysql_max_word_len', $mysql_info['ft_max_word_len']);
        $this->config->set('fulltext_mysql_min_word_len', $mysql_info['ft_min_word_len']);
        return false;
    }