diff options
author | Sarven Capadisli <csarven@status.net> | 2009-11-17 19:52:19 +0000 |
---|---|---|
committer | Sarven Capadisli <csarven@status.net> | 2009-11-17 19:52:19 +0000 |
commit | 020c2b48b6a8340b7867cb575573dc4dbbe557a0 (patch) | |
tree | f03f5317d93f72ec921d00c2d90fc8083a8b34d8 /classes/Config.php | |
parent | f425f8538d8433af83ef67dd0c69fe159b421026 (diff) | |
parent | 3a980a75fc04da27da693925ee8401fc33602b8e (diff) |
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'classes/Config.php')
-rw-r--r-- | classes/Config.php | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/classes/Config.php b/classes/Config.php index 92f237d7f..390d75381 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -120,6 +120,35 @@ class Config extends Memcached_DataObject return $result; } + function &pkeyGet($kv) + { + return Memcached_DataObject::pkeyGet('Config', $kv); + } + + static function save($section, $setting, $value) + { + $result = null; + + $config = Config::pkeyGet(array('section' => $section, + 'setting' => $setting)); + + if (!empty($config)) { + $orig = clone($config); + $config->value = $value; + $result = $config->update($orig); + } else { + $config = new Config(); + + $config->section = $section; + $config->setting = $setting; + $config->value = $value; + + $result = $config->insert(); + } + + return $result; + } + function _blowSettingsCache() { $c = self::memcache(); |