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; }
if (count($args) == 3) { $value = $args[2]; } else { $value = null; } try { if (have_option('d', 'delete')) { // Delete if (count($args) != 2) { show_help(); exit(1); } if (have_option('v', 'verbose')) { print "Deleting setting {$section}/{$setting}..."; } $setting = Config::pkeyGet(array('section' => $section, 'setting' => $setting)); if (empty($setting)) { print "Not found.\n"; } else { $result = $setting->delete(); if ($result) { print "DONE.\n"; } else { print "ERROR.\n"; } } } else { if (count($args) == 2) { // show if (have_option('v', 'verbose')) { print "{$section}/{$setting} = ";