Пример #1
0
        }
    }
    $qlp['service_id'] = array($service_id);
    $queue_list = get_queue_list_complex2($pdo, 0, 15, $qlp);
    $solr_config = pdo_get_solr_config($pdo, $service_id);
    $solr_config = json_decode($solr_config['config_json'], true);
    $dataimport = pdo_get_dataimport($pdo, $service_id);
}
//instance list & host list - tab2
if (in_array($tab, array('2', '4'))) {
    $instance_list = get_instance_list_complex($pdo, array('service_id' => $service_id, 'with_unbind' => '1'));
    $host_list = change_array_key(get_host_list($pdo), 'host_id');
}
//solr_schema - tab1/2
if (in_array($tab, array('1', '3'))) {
    $solr_schema = pdo_get_solr_schema($pdo, $service_id);
    if ($service_info['schema_type'] == 1) {
        $solr_schema = json_decode($solr_schema['schema_json'], true);
    } elseif ($service_info['schema_type'] == 2) {
        $schema_info = $solr_schema['schema_json'];
        $doc = new DomDocument();
        $doc->loadXML($schema_info);
        $xpath = new DomXPath($doc);
        $query = '//field';
        $nodelist = $xpath->query($query);
        foreach ($nodelist as $key => $node) {
            // var_dump ($node->attributes);
            foreach ($node->attributes as $attr) {
                $menu[$key][$attr->name] = $attr->value;
                // var_dump($attr->name .'=' . $attr->value);
            }
Пример #2
0
if (count($argv) < 2 || !preg_match("/^[0-9]+\$/", $argv[1])) {
    echo "<!-- # Usage: {$argv[0]} instance_id -->\n";
    exit(2);
}
$instance_id = $argv[1];
$instance = pdo_get_instance_byid($link, $instance_id);
if (!$instance) {
    echo "<!-- # Instance not exists -->\n";
    exit(1);
}
$service = get_service_list_by_mapping($link, $instance);
if (!$service) {
    echo "<!-- # Service mapping not exists -->\n";
    exit(1);
}
$config = pdo_get_solr_schema($link, $service[0]["service_id"]);
if (!$config) {
    echo "<!-- # Solr schema not exists -->\n";
    exit(1);
}
if ($service[0]['schema_type'] == 1) {
    $json = json_decode($config["schema_json"], true);
    if (!get_version_dir($service[0]["solr_version"])) {
        exit(1);
    }
    $template = file_get_contents($base . '/' . get_version_dir($service[0]["solr_version"]) . '/schema.xml.tpl');
    //$template = file_get_contents(build_path_configtpl($solr_root, $instance['port_num'])."/schema.xml.tpl");
    if (!$template) {
        $template = file_get_contents($base . "/schema.xml.tpl");
    }
    foreach ($json as $k => $v) {
Пример #3
0
            $is_dynamic_field = (bool) isset($params['dynamic_field']);
            update_schema_fields($pdo, $field, $service_id, $is_dynamic_field);
        } else {
            $solr_schema_attr = $params['hand_config_schema'];
            update_schema($pdo, $service_id, $solr_schema_attr);
        }
        //      msg_redirect('schema_fields.php?action=list&service_id='.$service_id);
        msg_redirect('service_detail.php?service_id=' . $service_id . '&tab=3');
        break;
    case 'delete':
        $name = $params['name'];
        $schema_config = pdo_get_solr_schema($pdo, $service_id);
        $schema_config = json_decode($schema_config['schema_json'], true);
        if ($schema_config['uniqueKey'] == $name) {
            msg_redirect('back', "This field is used by \\'uniqueKey\\'");
        }
        if ($schema_config['defaultSearchField'] == $name) {
            msg_redirect('back', "This field is used by \\'defaultSearchField\\'");
        }
        delete_schema_fields($pdo, $name, $service_id);
        //        msg_redirect('schema_fields.php?action=list&service_id='.$service_id);
        msg_redirect('service_detail.php?service_id=' . $service_id . '&tab=3');
        break;
    case 'list':
        $template = 'schema_fields_list';
        $schema_config = pdo_get_solr_schema($pdo, $service_id);
        $schema_config['config'] = json_decode($schema_config['schema_json'], true);
        break;
}
$current_nav = 'service';
require_once './libraries/decorator.inc.php';
Пример #4
0
function delete_schema_fields($pdo, $name, $service_id)
{
    $schema_config = pdo_get_solr_schema($pdo, $service_id);
    $config = json_decode($schema_config['schema_json'], true);
    $config = remove_field_from_schema_json($config, $name);
    $config = json_encode($config);
    update_schema_config($pdo, $service_id, $config);
}