aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions.php
diff options
context:
space:
mode:
authorLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2003-08-10 18:42:20 +0000
committerLudovic Arnaud <ludovic_arnaud@users.sourceforge.net>2003-08-10 18:42:20 +0000
commit0c3708ecc670bf54469e941b1f9c00ed2d712edf (patch)
tree6c6a3c792371886f376b33f5753b23074e21b276 /phpBB/includes/functions.php
parent145399b4bcb75727915d77404dfd6fe16bd4d065 (diff)
downloadforums-0c3708ecc670bf54469e941b1f9c00ed2d712edf.tar
forums-0c3708ecc670bf54469e941b1f9c00ed2d712edf.tar.gz
forums-0c3708ecc670bf54469e941b1f9c00ed2d712edf.tar.bz2
forums-0c3708ecc670bf54469e941b1f9c00ed2d712edf.tar.xz
forums-0c3708ecc670bf54469e941b1f9c00ed2d712edf.zip
Moved sql_close() down, after the cache is unloaded.
git-svn-id: file:///svn/phpbb/trunk@4365 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r--phpBB/includes/functions.php32
1 files changed, 12 insertions, 20 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php
index 5ccd044545..d860381b65 100644
--- a/phpBB/includes/functions.php
+++ b/phpBB/includes/functions.php
@@ -23,22 +23,13 @@ function set_config($config_name, $config_value, $is_dynamic = FALSE)
{
global $db, $cache, $config;
- if (isset($config[$config_name]))
- {
- if ($config[$config_name] != $config_value)
- {
- $sql = 'UPDATE ' . CONFIG_TABLE . "
- SET config_value = '" . $db->sql_escape($config_value) . "'
- WHERE config_name = '$config_name'";
- $db->sql_query($sql);
- }
- }
- else
- {
- $sql = 'DELETE FROM ' . CONFIG_TABLE . "
- WHERE config_name = '$config_name'";
- $db->sql_query($sql);
+ $sql = 'UPDATE ' . CONFIG_TABLE . "
+ SET config_value = '" . $db->sql_escape($config_value) . "'
+ WHERE config_name = '$config_name'";
+ $db->sql_query($sql);
+ if (!$db->sql_affectedrows() && !isset($config[$config_name]))
+ {
$sql = 'INSERT INTO ' . CONFIG_TABLE . " (config_name, config_value)
VALUES ('$config_name', '" . $db->sql_escape($config_value) . "')";
$db->sql_query($sql);
@@ -48,7 +39,7 @@ function set_config($config_name, $config_value, $is_dynamic = FALSE)
if (!$is_dynamic)
{
- $cache->put('config', $config);
+ $cache->destroy('config');
}
}
@@ -1401,14 +1392,15 @@ function page_footer()
$template->display('body');
- // Close our DB connection.
- $db->sql_close();
-
- // Unload cache
+ // Unload cache, must be done before the DB connection if closed
if (!empty($cache))
{
$cache->unload();
}
+
+ // Close our DB connection.
+ $db->sql_close();
+
exit;
}