aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/adm/pagestart.php6
-rw-r--r--phpBB/includes/functions.php32
2 files changed, 15 insertions, 23 deletions
diff --git a/phpBB/adm/pagestart.php b/phpBB/adm/pagestart.php
index 4f2339556c..cd1d0f852d 100644
--- a/phpBB/adm/pagestart.php
+++ b/phpBB/adm/pagestart.php
@@ -111,14 +111,14 @@ function adm_page_footer($copyright_html = true)
{
global $cache, $config, $db, $phpEx;
- // Close our DB connection.
- $db->sql_close();
-
if (!empty($cache))
{
$cache->unload();
}
+ // Close our DB connection.
+ $db->sql_close();
+
?>
</td>
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;
}