mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
Merge branch 'ticket/bantu/10139' into develop
This commit is contained in:
commit
37b38abec6
2 changed files with 34 additions and 34 deletions
|
@ -106,12 +106,12 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
|
||||||
/**
|
/**
|
||||||
* Removes a configuration option
|
* Removes a configuration option
|
||||||
*
|
*
|
||||||
* @param String $key The configuration option's name
|
* @param String $key The configuration option's name
|
||||||
* @param bool $cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached
|
* changes too frequently to be efficiently cached
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete($key, $cache = true)
|
public function delete($key, $use_cache = true)
|
||||||
{
|
{
|
||||||
unset($this->config[$key]);
|
unset($this->config[$key]);
|
||||||
}
|
}
|
||||||
|
@ -119,12 +119,12 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
|
||||||
/**
|
/**
|
||||||
* Sets a configuration option's value
|
* Sets a configuration option's value
|
||||||
*
|
*
|
||||||
* @param string $key The configuration option's name
|
* @param string $key The configuration option's name
|
||||||
* @param string $value New configuration value
|
* @param string $value New configuration value
|
||||||
* @param bool $cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached.
|
* changes too frequently to be efficiently cached.
|
||||||
*/
|
*/
|
||||||
public function set($key, $value, $cache = true)
|
public function set($key, $value, $use_cache = true)
|
||||||
{
|
{
|
||||||
$this->config[$key] = $value;
|
$this->config[$key] = $value;
|
||||||
}
|
}
|
||||||
|
@ -135,16 +135,16 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
|
||||||
*
|
*
|
||||||
* @param string $key The configuration option's name
|
* @param string $key The configuration option's name
|
||||||
* @param string $old_value Current configuration value
|
* @param string $old_value Current configuration value
|
||||||
* @param string $value New configuration value
|
* @param string $new_value New configuration value
|
||||||
* @param bool $cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached.
|
* changes too frequently to be efficiently cached.
|
||||||
* @return bool True if the value was changed, false otherwise.
|
* @return bool True if the value was changed, false otherwise.
|
||||||
*/
|
*/
|
||||||
public function set_atomic($key, $old_value, $value, $cache = true)
|
public function set_atomic($key, $old_value, $new_value, $use_cache = true)
|
||||||
{
|
{
|
||||||
if (!isset($this->config[$key]) || $this->config[$key] == $old_value)
|
if (!isset($this->config[$key]) || $this->config[$key] == $old_value)
|
||||||
{
|
{
|
||||||
$this->config[$key] = $value;
|
$this->config[$key] = $new_value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -155,10 +155,10 @@ class phpbb_config implements ArrayAccess, IteratorAggregate, Countable
|
||||||
*
|
*
|
||||||
* @param string $key The configuration option's name
|
* @param string $key The configuration option's name
|
||||||
* @param int $increment Amount to increment by
|
* @param int $increment Amount to increment by
|
||||||
* @param bool $cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached.
|
* changes too frequently to be efficiently cached.
|
||||||
*/
|
*/
|
||||||
function increment($key, $increment, $cache = true)
|
function increment($key, $increment, $use_cache = true)
|
||||||
{
|
{
|
||||||
if (!isset($this->config[$key]))
|
if (!isset($this->config[$key]))
|
||||||
{
|
{
|
||||||
|
|
|
@ -93,12 +93,12 @@ class phpbb_config_db extends phpbb_config
|
||||||
/**
|
/**
|
||||||
* Removes a configuration option
|
* Removes a configuration option
|
||||||
*
|
*
|
||||||
* @param String $key The configuration option's name
|
* @param String $key The configuration option's name
|
||||||
* @param bool $cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached
|
* changes too frequently to be efficiently cached
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete($key, $cache = true)
|
public function delete($key, $use_cache = true)
|
||||||
{
|
{
|
||||||
$sql = 'DELETE FROM ' . $this->table . "
|
$sql = 'DELETE FROM ' . $this->table . "
|
||||||
WHERE config_name = '" . $this->db->sql_escape($key) . "'";
|
WHERE config_name = '" . $this->db->sql_escape($key) . "'";
|
||||||
|
@ -106,7 +106,7 @@ class phpbb_config_db extends phpbb_config
|
||||||
|
|
||||||
unset($this->config[$key]);
|
unset($this->config[$key]);
|
||||||
|
|
||||||
if ($cache)
|
if ($use_cache)
|
||||||
{
|
{
|
||||||
$this->cache->destroy('config');
|
$this->cache->destroy('config');
|
||||||
}
|
}
|
||||||
|
@ -115,14 +115,14 @@ class phpbb_config_db extends phpbb_config
|
||||||
/**
|
/**
|
||||||
* Sets a configuration option's value
|
* Sets a configuration option's value
|
||||||
*
|
*
|
||||||
* @param string $key The configuration option's name
|
* @param string $key The configuration option's name
|
||||||
* @param string $value New configuration value
|
* @param string $value New configuration value
|
||||||
* @param bool $cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached.
|
* changes too frequently to be efficiently cached.
|
||||||
*/
|
*/
|
||||||
public function set($key, $value, $cache = true)
|
public function set($key, $value, $use_cache = true)
|
||||||
{
|
{
|
||||||
$this->set_atomic($key, false, $value, $cache);
|
$this->set_atomic($key, false, $value, $use_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,11 +133,11 @@ class phpbb_config_db extends phpbb_config
|
||||||
* @param mixed $old_value Current configuration value or false to ignore
|
* @param mixed $old_value Current configuration value or false to ignore
|
||||||
* the old value
|
* the old value
|
||||||
* @param string $new_value New configuration value
|
* @param string $new_value New configuration value
|
||||||
* @param bool $cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached
|
* changes too frequently to be efficiently cached
|
||||||
* @return bool True if the value was changed, false otherwise
|
* @return bool True if the value was changed, false otherwise
|
||||||
*/
|
*/
|
||||||
public function set_atomic($key, $old_value, $new_value, $cache = true)
|
public function set_atomic($key, $old_value, $new_value, $use_cache = true)
|
||||||
{
|
{
|
||||||
$sql = 'UPDATE ' . $this->table . "
|
$sql = 'UPDATE ' . $this->table . "
|
||||||
SET config_value = '" . $this->db->sql_escape($new_value) . "'
|
SET config_value = '" . $this->db->sql_escape($new_value) . "'
|
||||||
|
@ -160,11 +160,11 @@ class phpbb_config_db extends phpbb_config
|
||||||
$sql = 'INSERT INTO ' . $this->table . ' ' . $this->db->sql_build_array('INSERT', array(
|
$sql = 'INSERT INTO ' . $this->table . ' ' . $this->db->sql_build_array('INSERT', array(
|
||||||
'config_name' => $key,
|
'config_name' => $key,
|
||||||
'config_value' => $new_value,
|
'config_value' => $new_value,
|
||||||
'is_dynamic' => ($cache) ? 0 : 1));
|
'is_dynamic' => ($use_cache) ? 0 : 1));
|
||||||
$this->db->sql_query($sql);
|
$this->db->sql_query($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($cache)
|
if ($use_cache)
|
||||||
{
|
{
|
||||||
$this->cache->destroy('config');
|
$this->cache->destroy('config');
|
||||||
}
|
}
|
||||||
|
@ -181,14 +181,14 @@ class phpbb_config_db extends phpbb_config
|
||||||
*
|
*
|
||||||
* @param string $key The configuration option's name
|
* @param string $key The configuration option's name
|
||||||
* @param int $increment Amount to increment by
|
* @param int $increment Amount to increment by
|
||||||
* @param bool $cache Whether this variable should be cached or if it
|
* @param bool $use_cache Whether this variable should be cached or if it
|
||||||
* changes too frequently to be efficiently cached.
|
* changes too frequently to be efficiently cached.
|
||||||
*/
|
*/
|
||||||
function increment($key, $increment, $cache = true)
|
function increment($key, $increment, $use_cache = true)
|
||||||
{
|
{
|
||||||
if (!isset($this->config[$key]))
|
if (!isset($this->config[$key]))
|
||||||
{
|
{
|
||||||
$this->set($key, '0', $cache);
|
$this->set($key, '0', $use_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_update = $this->db->cast_expr_to_string($this->db->cast_expr_to_bigint('config_value') . ' + ' . (int) $increment);
|
$sql_update = $this->db->cast_expr_to_string($this->db->cast_expr_to_bigint('config_value') . ' + ' . (int) $increment);
|
||||||
|
@ -197,7 +197,7 @@ class phpbb_config_db extends phpbb_config
|
||||||
SET config_value = ' . $sql_update . "
|
SET config_value = ' . $sql_update . "
|
||||||
WHERE config_name = '" . $this->db->sql_escape($key) . "'");
|
WHERE config_name = '" . $this->db->sql_escape($key) . "'");
|
||||||
|
|
||||||
if ($cache)
|
if ($use_cache)
|
||||||
{
|
{
|
||||||
$this->cache->destroy('config');
|
$this->cache->destroy('config');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue