1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-28 20:40:24 +02:00

Merge branch 'ticket/jellydoughnut/9637' into develop-olympus

* ticket/jellydoughnut/9637:
  [ticket/9637] Do not cache SQL server version in all cases
This commit is contained in:
Andreas Fischer
2010-07-11 01:44:59 +02:00
10 changed files with 52 additions and 25 deletions

View File

@@ -108,13 +108,14 @@ class dbal_postgres extends dbal
/**
* Version information about used database
* @param bool $raw if true, only return the fetched sql_server_version
* @param bool $use_cache If true, it is safe to retrieve the value from the cache
* @return string sql server version
*/
function sql_server_info($raw = false)
function sql_server_info($raw = false, $use_cache = true)
{
global $cache;
if (empty($cache) || ($this->sql_server_version = $cache->get('pgsql_version')) === false)
if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('pgsql_version')) === false)
{
$query_id = @pg_query($this->db_connect_id, 'SELECT VERSION() AS version');
$row = @pg_fetch_assoc($query_id, null);
@@ -122,7 +123,7 @@ class dbal_postgres extends dbal
$this->sql_server_version = (!empty($row['version'])) ? trim(substr($row['version'], 10)) : 0;
if (!empty($cache))
if (!empty($cache) && $use_cache)
{
$cache->put('pgsql_version', $this->sql_server_version);
}