diff --git a/config/alfresco/bootstrap/webscripts/blogsearch.get.atom.ftl b/config/alfresco/bootstrap/webscripts/blogsearch.get.atom.ftl index a8a3149cb4..5c32f0864e 100644 --- a/config/alfresco/bootstrap/webscripts/blogsearch.get.atom.ftl +++ b/config/alfresco/bootstrap/webscripts/blogsearch.get.atom.ftl @@ -1,7 +1,7 @@ Alfresco (${server.edition}) - Blog query: ${args.q} + Blog query: ${args.q?html} ${xmldate(date)} ${absurl(url.context)}/images/logo/AlfrescoLogo16.ico <#list resultset as node> diff --git a/config/alfresco/bootstrap/webscripts/blogsearch.get.html.ftl b/config/alfresco/bootstrap/webscripts/blogsearch.get.html.ftl index 912a9d4983..18909d903c 100644 --- a/config/alfresco/bootstrap/webscripts/blogsearch.get.html.ftl +++ b/config/alfresco/bootstrap/webscripts/blogsearch.get.html.ftl @@ -1,7 +1,7 @@ Alfresco - Blog query: ${args.q} + Blog query: ${args.q?html}
<#list resultset as node> diff --git a/config/alfresco/messages/patch-service.properties b/config/alfresco/messages/patch-service.properties index 8e8e11507c..82909c03e7 100644 --- a/config/alfresco/messages/patch-service.properties +++ b/config/alfresco/messages/patch-service.properties @@ -149,6 +149,10 @@ patch.tagRootCategory.description=Adds 'Tags' as new top-level category root. patch.sitesFolder.description=Adds 'Sites' folder to Company Home. +patch.fixWebscriptTemplate.description=Reimport fixed sample template. +patch.fixWebscriptTemplate.skip=Template not found. Skipping. +patch.fixWebscriptTemplate.result=Fixed template was updated. + patch.updateDmPermissions.description=Update ACLs on all DM node objects to the new 3.0 permission model patch.db-V3.0-0-CreateActivitiesExtras.description=Replaced by 'patch.db-V3.0-ActivityTables', which must run first. diff --git a/config/alfresco/patch/patch-services-context.xml b/config/alfresco/patch/patch-services-context.xml index 8f85fbd4ed..330300d4ca 100644 --- a/config/alfresco/patch/patch-services-context.xml +++ b/config/alfresco/patch/patch-services-context.xml @@ -1096,4 +1096,27 @@ + + + + + 0 + + + 9000 + + + 9001 + + + + + /app:company_home/app:dictionary/cm:webscripts/cm:org/cm:alfresco/cm:sample/cm:blogsearch.get.html.ftl + + + alfresco/bootstrap/webscripts/blogsearch.get.html.ftl + + + diff --git a/config/alfresco/version.properties b/config/alfresco/version.properties index f44ac30a94..b1ae0d1b6f 100644 --- a/config/alfresco/version.properties +++ b/config/alfresco/version.properties @@ -23,4 +23,4 @@ version.build=r@scm-revision@-b@build-number@ # Schema number -version.schema=9000 +version.schema=9001 diff --git a/source/java/org/alfresco/repo/admin/patch/impl/FixTemplatePatch.java b/source/java/org/alfresco/repo/admin/patch/impl/FixTemplatePatch.java new file mode 100755 index 0000000000..da2d07c498 --- /dev/null +++ b/source/java/org/alfresco/repo/admin/patch/impl/FixTemplatePatch.java @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2005-2015 Alfresco Software Limited. + * + * This file is part of Alfresco + * + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + */ +package org.alfresco.repo.admin.patch.impl; + +import java.io.InputStream; +import java.util.List; + +import org.alfresco.model.ContentModel; +import org.alfresco.repo.admin.patch.AbstractPatch; +import org.alfresco.repo.content.MimetypeMap; +import org.alfresco.repo.model.Repository; +import org.alfresco.service.cmr.repository.ContentService; +import org.alfresco.service.cmr.repository.ContentWriter; +import org.alfresco.service.cmr.repository.NodeRef; +import org.springframework.extensions.surf.util.I18NUtil; + +/** + * MNT-13190: Fix template + * + * @author Viachaslau Tsikhanovich + * + */ +public class FixTemplatePatch extends AbstractPatch +{ + private static final String MSG_SUCCESS = "patch.fixWebscriptTemplate.result"; + private static final String MSG_SKIP = "patch.fixWebscriptTemplate.skip"; + + private Repository repository; + protected ContentService contentService; + private String target; + private String source; + + public void setRepository(Repository repository) + { + this.repository = repository; + } + + public void setContentService(ContentService contentService) + { + this.contentService = contentService; + } + + public void setTarget(String target) + { + this.target = target; + } + + public void setSource(String source) + { + this.source = source; + } + + + @Override + protected String applyInternal() throws Exception + { + List refs = searchService.selectNodes( + repository.getRootHome(), + target, + null, + namespaceService, + false); + if (refs.size() < 1) + { + // skip as it can be deleted + return I18NUtil.getMessage(MSG_SKIP); + } + else + { + updateContent(refs.get(0)); + } + + return I18NUtil.getMessage(MSG_SUCCESS); + } + + private void updateContent(NodeRef nodeRef) + { + // Make versionable + nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null); + + // Update content + InputStream is = this.getClass().getClassLoader().getResourceAsStream(source); + if (is != null) + { + ContentWriter contentWriter = contentService.getWriter(nodeRef, ContentModel.PROP_CONTENT, true); + contentWriter.setMimetype(MimetypeMap.MIMETYPE_TEXT_PLAIN); + contentWriter.setEncoding("UTF-8"); + contentWriter.putContent(is); + } + } + +}