case 'start': $standby_node = $params['a']; $output = $repmgr->remote_start($standby_node); $json = array('exit_status' => $exit_status = array_pop($output), 'success' => $exit_status == '0', 'output' => is_array($output) ? implode('\\n', $output) : $output, 'ps' => $repmgr->remote_ps($standby_node)); echo json_encode($json); break; case 'promote': #still experimental $new_primary_node = $params['a']; $output = $repmgr->promote($new_primary_node); $json = array('output' => $output); echo json_encode($json); break; case 'add_hard': $node = $params['a']; $output = $repmgr->add($node); $json = array('output' => $output); echo json_encode($json); break; case 'add_soft': $cluster = $params['a']; $conninfo = $params['b']; $id = $params['c']; $json = array(); #$repmgr->add_soft has all these checks #but it does not give detailed error output #we need these details for our interface if (!is_numeric($id)) { $json['error'] = "bad id"; } $rs = $db->Execute("select count(*) as count from repmgr_{$repmgr_cluster_name}.repl_nodes where id = {$id}");