Skip to content
Snippets Groups Projects
Commit aec6f406 authored by Jared Hancock's avatar Jared Hancock
Browse files

Prefer session persistent configuration over database

This will allow setting something in the session and having that value
override the value from the database. If ->persist() is called for a given
key, a following ->get() will result in the session persisted value being
returned. ->set() will still save the value in the database.

This is mostly useful for last-mile scenarios (and future plugins) that need
to affect the configuration of the system without altering the data in the
configuration table.
parent 31b05d57
No related branches found
No related tags found
No related merge requests found
......@@ -49,10 +49,10 @@ class Config {
}
function get($key, $default=null) {
if (isset($this->config[$key]))
return $this->config[$key]['value'];
elseif (isset($this->session[$key]))
if (isset($this->session[$key]))
return $this->session[$key];
elseif (isset($this->config[$key]))
return $this->config[$key]['value'];
elseif ($default !== null)
return $this->set($key, $default);
return null;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment