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
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
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
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.
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.
@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); } }
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.