summaryrefslogtreecommitdiff
path: root/classes/Config.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-11-07 23:16:59 -0500
committerEvan Prodromou <evan@status.net>2009-11-07 23:16:59 -0500
commit408510f527be0a1a22fa564369fad48938b7bd02 (patch)
treec7bf87312eb2638e0f2ab09fa6c95467d49d671f /classes/Config.php
parentdd9fa0e6833432b1936a6375e4cb411fe340dec8 (diff)
pkeyGet() and save() methods for Config
Diffstat (limited to 'classes/Config.php')
-rw-r--r--classes/Config.php29
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();