02-12-2018 10:35 AM
Hi,
in my Alfresco (5.2.0, re21f2be5-b22) I'd like to disable versioning globally, only enabling it on demand. However, the documented way of putting "version.store.enableAutoVersioning=false" into alfresco-global.properties seems not to work. New files still get the cm:versioning aspect and store a history. Furthermore, if I remove the aspect manually from a file, I'm still able to upload new versions. Could this be a bug? Has anyone else observed such behaviour?
Thanks in advance,
Alex
02-12-2018 08:50 PM
Hi Alex,
I believe this behavior is from Share UI. If you try the same via API it will not enable versioning.
By default when you upload any content via share, it enables versioning. To disable, you will need to modify upload.post.js
02-13-2018 06:28 AM
Hello ashwin.mor,
thank you for your reply.
That would be quite inconsistent behaviour of Share.
I'm not sure if the API honors the setting. I tried uploading files from ezuno client, which is a desktop application that uses the API. It enabled versioning, too. However, I'm not sure if this is a "feature" of the app itself.
I also tested creating a file via webdav, which indeed did not add the versioning aspect.
I found a workaround without modifying .js files, using content rules and an additional custom aspect ("manuallyVersioned"). The rules are defined in some top folder and remove the "versionable" aspect from any content (on creation and update) if it doesn't have this custom aspect. Then I can allow versioning selectively for folders and files by adding both the "versionable" and the "manuallyVersioned" aspect.
Alex
02-13-2018 08:32 AM
Hi:
I can confirm that "Upload new version" action in Share works as mentioned / expected (adding the versioning aspect ) and also that webdav does not add the versioning aspect. The API may add the versioning aspect or not... as commented in ezuno client.
Regards.
--C.
01-28-2021 07:42 AM
Hi ashwin_mor,
What changes need to be made to the upload.post.js file?
I saw that it is on /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-5.2.g.jar
In which folder structure?
Thanks a lot.
José Roberto.
01-29-2021 09:01 AM
@jbrasil wrote:
Hi ashwin_mor,
What changes need to be made to the upload.post.js file?
I saw that it is on /opt/alfresco/tomcat/webapps/alfresco/WEB-INF/lib/alfresco-repository-5.2.g.jar
In which folder structure?
Thanks a lot.
José Roberto.
I think it is the same question here, i replied on this thread: https://hub.alfresco.com/t5/alfresco-content-services-forum/disabling-auto-versioning-in-alfresco-li...
To version on demand after disabling the versioning via alfresco-global.properties, you should better make use of behaviors. Don't change anything in upload.post.js file. With behaviors you would get more control over the nodes and their types and you can choose to version a specific type of node too.
https://docs.alfresco.com/6.1/references/dev-extension-points-behaviors.html
Create a behavior onCreateNode event and bind the behavior to a content type and then set the properties using node service on the creating node like:
private void setVersionPropertiesOnDemand(NodeRef nodeRef) { if (nodeService.hasAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE)) { Map<QName,Serializable> props = nodeService.getProperties(nodeRef); props.put(ContentModel.PROP_AUTO_VERSION, true); props.put(ContentModel.PROP_AUTO_VERSION_PROPS, true); nodeService.addProperties(nodeRef, props); } else { Map<QName,Serializable> versionProps = new ConcurrentHashMap<QName, Serializable>(); versionProps.put(ContentModel.PROP_AUTO_VERSION, true); versionProps.put(ContentModel.PROP_AUTO_VERSION_PROPS, true); nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, versionProps); } }
Explore our Alfresco products with the links below. Use labels to filter content by product module.