01-28-2021 09:02 AM
Hi all,
I am not able to disable auto versioning in Alfresco Linux.
Tested in version 5.2 and 6.1
See parameters in global properties
#Disable file versioning
cm: autoVersion = false
cm: initialVersion = false
version.store.initialVersion = false
version.store.enableAutoVersioning = false
version.store.enableAutoVersionOnUpdateProps = false
What is wrong?
Thanks a lot
José Roberto
01-29-2021 11:51 AM
@jbrasil wrote:
Hi all,
I am not able to disable auto versioning in Alfresco Linux.
Tested in version 5.2 and 6.1
See parameters in global properties#Disable file versioning
cm: autoVersion = false
cm: initialVersion = falseversion.store.initialVersion = false
version.store.enableAutoVersioning = false
version.store.enableAutoVersionOnUpdateProps = falseWhat is wrong?
Thanks a lot
José Roberto
When you update these properties, it doesn't affect existing nodes. It will affect only newly created nodes. Auto version will continue to happen on existing nodes as those nodes would have below given props set:
This is the default configuration at repo level:
version.store.initialVersion=true version.store.enableAutoVersioning=true version.store.enableAutoVersionOnUpdateProps=false
You would need to cleanup the old existing objects by running a script/webscript to set the values to false in order to make them follow the versioning disablement. I don't think there is any change needed in upload functionality If i understood the query properly.
Have a look at these posts:
If you want to version nodes on demand as the nodes are created into repo, 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_INITIAL_VERSION, true); 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_INITIAL_VERSION, true); versionProps.put(ContentModel.PROP_AUTO_VERSION, true); versionProps.put(ContentModel.PROP_AUTO_VERSION_PROPS, true); nodeService.addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, versionProps); } }
01-28-2021 10:17 AM
Hi,
I think your problem is described here: https://hub.alfresco.com/t5/alfresco-content-services-forum/cannot-disable-global-versioning/td-p/35...
In short: you may need to modify upload.post.js
Cheers!
01-28-2021 10:44 AM
Hi cristinamr,
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?
In the post he quoted, he doesn't say what the changes are.
Can you tell me?
With best regards,
José Roberto.
01-29-2021 05:23 AM
You could try it with rules maybe. Try to set it on whole Document Library for the Site you want to disable versioning in it.
Didn't have time to test it more (only uploaded new version of one document and version is still 1.0), so don't know if it will work in all cases.
01-29-2021 05:48 AM
Hi sufo,
The rule did not work with OCR.
The following error message occurs:
00280001 Failed to execute script 'classpath *: alfresco / site-webscripts / org / alfresco / components / documentlibrary / data / surf-doclist.get.js': 00280000
Thanks.
01-29-2021 10:02 AM
I don't know what OCR you are using. If it acts on events (like node creation and update) and is synchronous, then it can cause some trouble as this rule is also synchronous and runs in transaction. Do you see any details in the repository log (alfresco.log) about the error?
01-29-2021 11:51 AM
@jbrasil wrote:
Hi all,
I am not able to disable auto versioning in Alfresco Linux.
Tested in version 5.2 and 6.1
See parameters in global properties#Disable file versioning
cm: autoVersion = false
cm: initialVersion = falseversion.store.initialVersion = false
version.store.enableAutoVersioning = false
version.store.enableAutoVersionOnUpdateProps = falseWhat is wrong?
Thanks a lot
José Roberto
When you update these properties, it doesn't affect existing nodes. It will affect only newly created nodes. Auto version will continue to happen on existing nodes as those nodes would have below given props set:
This is the default configuration at repo level:
version.store.initialVersion=true version.store.enableAutoVersioning=true version.store.enableAutoVersionOnUpdateProps=false
You would need to cleanup the old existing objects by running a script/webscript to set the values to false in order to make them follow the versioning disablement. I don't think there is any change needed in upload functionality If i understood the query properly.
Have a look at these posts:
If you want to version nodes on demand as the nodes are created into repo, 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_INITIAL_VERSION, true); 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_INITIAL_VERSION, true); 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.