X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=classes%2FConfig.php;h=c457da1a5a1f74515f0b15537e49b59024c107e2;hb=94392ab00ceefec6105ac7d6e6846fb644bbd0f1;hp=ba0db588cafa1fee01c65c4d0cbd61ea53de24a8;hpb=9ca3c3d1c31ff2b30ecd7bbc2ec9ec3722173f7f;p=quix0rs-gnu-social.git diff --git a/classes/Config.php b/classes/Config.php index ba0db588ca..c457da1a5a 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -17,16 +17,12 @@ * along with this program. If not, see . */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * Table Definition for config */ -require_once INSTALLDIR.'/classes/Memcached_DataObject.php'; - class Config extends Managed_DataObject { ###START_AUTOCODE @@ -35,10 +31,7 @@ class Config extends Managed_DataObject public $__table = 'config'; // table name public $section; // varchar(32) primary_key not_null public $setting; // varchar(32) primary_key not_null - public $value; // varchar(255) - - /* Static get */ - function staticGet($k,$v=NULL) { return Memcached_DataObject::staticGet('Config',$k,$v); } + public $value; // text /* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE @@ -49,7 +42,7 @@ class Config extends Managed_DataObject 'fields' => array( 'section' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration section'), 'setting' => array('type' => 'varchar', 'length' => 32, 'not null' => true, 'default' => '', 'description' => 'configuration setting'), - 'value' => array('type' => 'varchar', 'length' => 255, 'description' => 'configuration value'), + 'value' => array('type' => 'text', 'description' => 'configuration value'), ), 'primary key' => array('section', 'setting'), ); @@ -59,9 +52,13 @@ class Config extends Managed_DataObject static function loadSettings() { - $settings = self::_getSettings(); - if (!empty($settings)) { - self::_applySettings($settings); + try { + $settings = self::_getSettings(); + if (!empty($settings)) { + self::_applySettings($settings); + } + } catch (Exception $e) { + return; } } @@ -114,29 +111,24 @@ class Config extends Managed_DataObject return $result; } - function delete() + function delete($useWhere=false) { - $result = parent::delete(); - if ($result) { + $result = parent::delete($useWhere); + if ($result !== false) { Config::_blowSettingsCache(); } return $result; } - function update($orig=null) + function update($dataObject=false) { - $result = parent::update($orig); - if ($result) { + $result = parent::update($dataObject); + if ($result !== false) { Config::_blowSettingsCache(); } return $result; } - function pkeyGet($kv) - { - return Memcached_DataObject::pkeyGet('Config', $kv); - } - static function save($section, $setting, $value) { $result = null;