msg_redirect("back", 'Can not unbind master instance from running service!'); } if ($instance_info["writable"] == 1 || $instance_info["readable"] == 1) { msg_redirect("back", 'Can not unbind instance when it\\\'s writable or readable!'); } } remove_instance_from_service($pdo, $instance_id, $username); instance_redirect(); break; case 'writable': $username = check_login($def_url); $instance_id = $params['instance_id']; $service_mapping = pdo_get_mapping_by_instance_id($pdo, $instance_id); $service_info = pdo_get_service_byid($pdo, $service_mapping['service_id']); /*非zk的只能有一个writable*/ if (!isset_zk_service($pdo, $service_mapping['service_id'])) { $writbale_instance = get_instance_list_complex($pdo, array('service_id' => $service_mapping['service_id'], 'writable' => '1')); if ($writbale_instance) { msg_redirect("back", 'Writable instance should be unique before 4.0!'); } } change_instance_writable($pdo, $instance_id); reload_service_by_instance($pdo, $instance_id, $username); instance_redirect(); break; case 'unwritable': $username = check_login($def_url); $instance_id = $params['instance_id']; $service_mapping = pdo_get_mapping_by_instance_id($pdo, $instance_id); $service_info = pdo_get_service_byid($pdo, $service_mapping['service_id']); $writbale_instance = get_instance_list_complex($pdo, array('service_id' => $service_mapping['service_id'], 'writable' => '1'));
function isset_zk_instance($pdo, $instance_id) { $service_id = get_service_id_by_instance_id($pdo, $instance_id); if ($service_id) { return isset_zk_service($pdo, $service_id); } return false; }