phpbb\search\fulltext_sphinx::__construct PHP Method

__construct() public method

Constructor Creates a new \phpbb\search\fulltext_postgres, which is used as a search backend
public __construct ( string | boolean &$error, string $phpbb_root_path, string $phpEx, phpbb\auth\auth $auth, phpbb\config\config $config, $db, phpbb\user $user )
$error string | boolean Any error that occurs is passed on through this reference variable otherwise false
$phpbb_root_path string Relative path to phpBB root
$phpEx string PHP file extension
$auth phpbb\auth\auth Auth object
$config phpbb\config\config Config object
$user phpbb\user User object
    public function __construct(&$error, $phpbb_root_path, $phpEx, $auth, $config, $db, $user)
    {
        $this->phpbb_root_path = $phpbb_root_path;
        $this->php_ext = $phpEx;
        $this->config = $config;
        $this->user = $user;
        $this->db = $db;
        $this->auth = $auth;
        // Initialize \phpbb\db\tools\tools object
        global $phpbb_container;
        // TODO inject into object
        $this->db_tools = $phpbb_container->get('dbal.tools');
        if (!$this->config['fulltext_sphinx_id']) {
            $this->config->set('fulltext_sphinx_id', unique_id());
        }
        $this->id = $this->config['fulltext_sphinx_id'];
        $this->indexes = 'index_phpbb_' . $this->id . '_delta;index_phpbb_' . $this->id . '_main';
        if (!class_exists('SphinxClient')) {
            require $this->phpbb_root_path . 'includes/sphinxapi.' . $this->php_ext;
        }
        // Initialize sphinx client
        $this->sphinx = new \SphinxClient();
        $this->sphinx->SetServer($this->config['fulltext_sphinx_host'] ? $this->config['fulltext_sphinx_host'] : 'localhost', $this->config['fulltext_sphinx_port'] ? (int) $this->config['fulltext_sphinx_port'] : 9312);
        $error = false;
    }