[feature/postgresql-fulltext-search] use version_compare

version_compare is used for version comparision and pgsql version is now
a global variable that is displayed in the acp too.

PHPBB3-9730
This commit is contained in:
Dhruv Goel 2012-06-16 03:05:40 +05:30
parent 8ba510a99d
commit ebc4c20199

View file

@ -29,6 +29,7 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
var $tsearch_query;
var $common_words = array();
var $tsearch_usable = false;
var $version;
public function __construct(&$error)
{
@ -39,8 +40,9 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
if ($db->sql_layer == 'postgres')
{
$pgsql_version = explode('.', substr($db->sql_server_info(), 10));
if ($pgsql_version[0] >= 9 || $pgsql_version[0] == 8 && $pgsql_version[1] >= 3)
$pgsql_version = explode(',', substr($db->sql_server_info(), 10));
$this->version = trim($pgsql_version[0]);
if(version_compare($this->version, '8.3', '>='))
{
$this->tsearch_usable = true;
}
@ -778,12 +780,10 @@ class phpbb_search_fulltext_postgres extends phpbb_search_base
{
global $user, $config, $db;
$pgsql_version = explode(',', substr($db->sql_server_info(), 10));
$tpl = '
<dl>
<dt><label>' . $user->lang['FULLTEXT_POSTGRES_VERSION_CHECK'] . '</label><br /><span>' . $user->lang['FULLTEXT_POSTGRES_VERSION_CHECK_EXPLAIN'] . '</span></dt>
<dd>' . (($this->tsearch_usable) ? $user->lang['YES'] : $user->lang['NO']) . ' (PostgreSQL ' . $pgsql_version[0] . ')</dd>
<dd>' . (($this->tsearch_usable) ? $user->lang['YES'] : $user->lang['NO']) . ' (PostgreSQL ' . $this->version . ')</dd>
</dl>
<dl>
<dt><label>' . $user->lang['FULLTEXT_POSTGRES_TS_NAME'] . '</label><br /><span>' . $user->lang['FULLTEXT_POSTGRES_TS_NAME_EXPLAIN'] . '</span></dt>