Technical migration manual from version 2.6.2 to version 2.6.3


Migration of the training search engine service

Please note that this migration also requires a graphical migration Manual for graphical migration from version 2.6.2 to version 2.6.3

Run the following script then rebuild live

var qm = session.getWorkspace().getQueryManager();

var query = qm.createQuery("//element(*, ametys:zoneItem)[ametys-internal:service = 'org.ametys.odf.service.SearchService']", javax.jcr.query.Query.XPATH);
var nodes = query.execute().getNodes();

var count = 0;
while (nodes.hasNext())
{
    var searchService = nodes.next();
    var serviceParam = searchService.getNode("ametys:service_parameters");

    if (serviceParam.hasProperty("ametys:displaySubProgram"))
    {
        var displaySubProgram = serviceParam.getProperty("ametys:displaySubProgram").getString();
        if (displaySubProgram == "true")
        {
            serviceParam.setProperty("ametys:displaySubProgram", "all");
            count++;
        }
        else if (displaySubProgram == "false")
        {
            serviceParam.setProperty("ametys:displaySubProgram", "none");
            count++;
        }
    }
    else
    {
        serviceParam.setProperty("ametys:displaySubProgram", "none");
        count++;
    }
    
    serviceParam.save();
}

print(count + " services have been migrated");
Back to top