X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FConfig.php;h=390d75381ac82fb74289a91fc6a77a011d875da0;hb=cac5a417f2a81b974781d4dbc40fd9d718a7a7f2;hp=5bec13fdc8d92a8d663745b895fedabc5292e366;hpb=9f356b55c6f419468771c0f3c2450010c0242abe;p=quix0rs-gnu-social.git diff --git a/classes/Config.php b/classes/Config.php old mode 100755 new mode 100644 index 5bec13fdc8..390d75381a --- a/classes/Config.php +++ b/classes/Config.php @@ -17,7 +17,9 @@ * along with this program. If not, see . */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('STATUSNET')) { + exit(1); +} /** * Table Definition for config @@ -118,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();