public function save() { set_exception_handler('json_exception_handler'); header('Cache-Control: no-cache, must-revalidate'); header('Content-type: application/json'); $data = file_get_contents("php://input"); $data = json_decode($data, true); $data = $data['data']; if (!$data) { throw new Exception('No data to save'); } $anychanged = false; foreach ($data as $key => $c) { if ($c['type'] == 'string') { if (!$anychanged && $c['value'] != get_db_config_item($key)) { $anychanged = true; } if ($c['value'] != get_db_config_item($key)) { $anychanged = true; set_config_item($key, $c['type'], $c['value']); } } } if (!$anychanged) { echo json_encode(array('status' => 'OK', 'message' => 'No configuration change detected')); } else { echo json_encode(array('status' => 'OK', 'message' => 'All configuration item successfully updated')); } }
public function migrate_content_path_to_r13() { acl_enforce('REGISTRY_STAFF'); set_exception_handler('json_exception_handler'); if ($this->input->get('val')) { set_config_item('harvested_contents_path', 'string', $this->input->get('val')); echo 'done'; } else { throw new Exception('val required'); } }