diff options
author | Josh Woody <a_jelly_doughnut@phpbb.com> | 2010-06-06 08:42:27 -0500 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2010-07-11 01:41:38 +0200 |
commit | 9c61455d264d92194f66549d244ec68cdb3c9ead (patch) | |
tree | fb25f7003482ea9f0eb07eb934e5daafe5a3cdc7 /phpBB/includes/db/mssql.php | |
parent | 355d4b8ff8d616ef8650240f936517ede03296b8 (diff) | |
download | forums-9c61455d264d92194f66549d244ec68cdb3c9ead.tar forums-9c61455d264d92194f66549d244ec68cdb3c9ead.tar.gz forums-9c61455d264d92194f66549d244ec68cdb3c9ead.tar.bz2 forums-9c61455d264d92194f66549d244ec68cdb3c9ead.tar.xz forums-9c61455d264d92194f66549d244ec68cdb3c9ead.zip |
[ticket/9637] Do not cache SQL server version in all cases
Because the existing cache is global, there is no way to differentiate between
each of two databases which may be two different DBAL objects pointing to
servers with wildly different versions of an RDBMS. phpBB only has this
situation in the UCF, thus only one file changed outside the DBAL. I have
added a second optional parameter, $use_cache to each of the implementations
of dbal::sql_server_info()
PHPBB3-9637
Diffstat (limited to 'phpBB/includes/db/mssql.php')
-rw-r--r-- | phpBB/includes/db/mssql.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/phpBB/includes/db/mssql.php b/phpBB/includes/db/mssql.php index 7134574691..6899a73902 100644 --- a/phpBB/includes/db/mssql.php +++ b/phpBB/includes/db/mssql.php @@ -65,13 +65,14 @@ class dbal_mssql 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('mssql_version')) === false) + if (!$use_cache || empty($cache) || ($this->sql_server_version = $cache->get('mssql_version')) === false) { $result_id = @mssql_query("SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY('productlevel'), SERVERPROPERTY('edition')", $this->db_connect_id); @@ -84,7 +85,7 @@ class dbal_mssql extends dbal $this->sql_server_version = ($row) ? trim(implode(' ', $row)) : 0; - if (!empty($cache)) + if (!empty($cache) && $use_cache) { $cache->put('mssql_version', $this->sql_server_version); } |