diff options
author | Maat <maat-pub@mageia.biz> | 2020-05-09 01:15:08 +0200 |
---|---|---|
committer | Maat <maat-pub@mageia.biz> | 2020-05-09 01:15:08 +0200 |
commit | 6985226b17e8a0ef0a720bf1d12fe0c216e13dab (patch) | |
tree | 116d2565ac02c40abe0548863c6badf8ec3e1d1e /phpBB/phpbb/config | |
parent | 8ea437e30605e0f66b5220bf904a61d7c1d11ddd (diff) | |
parent | 8d00784dfe2c8bcb10843ff70b4cfa998d703285 (diff) | |
download | forums-master.tar forums-master.tar.gz forums-master.tar.bz2 forums-master.tar.xz forums-master.zip |
Diffstat (limited to 'phpBB/phpbb/config')
-rw-r--r-- | phpBB/phpbb/config/config.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/phpBB/phpbb/config/config.php b/phpBB/phpbb/config/config.php index aaad333006..c619cae2fd 100644 --- a/phpBB/phpbb/config/config.php +++ b/phpBB/phpbb/config/config.php @@ -148,6 +148,25 @@ class config implements \ArrayAccess, \IteratorAggregate, \Countable } /** + * Checks configuration option's value only if the new_value matches the + * current configuration value and the configuration value does exist.Called + * only after set_atomic has been called. + * + * @param string $key The configuration option's name + * @param string $new_value New configuration value + * @throws \phpbb\exception\http_exception when config value is set and not equal to new_value. + * @return bool True if the value was changed, false otherwise. + */ + public function ensure_lock($key, $new_value) + { + if (isset($this->config[$key]) && $this->config[$key] == $new_value) + { + return true; + } + throw new \phpbb\exception\http_exception(500, 'Failure while aqcuiring locks.'); + } + + /** * Increments an integer configuration value. * * @param string $key The configuration option's name |